Page MenuHome

The ability to change the opacity of the wirefrane of the Uv editor
Needs ReviewPublic

Authored by Eitan (EitanSomething) on Fri, Jul 26, 5:18 AM.

Details

Summary

This was suggest on rightclickselect https://blender.community/c/rightclickselect/w0dbbc/

FEATURES

  • The user can now change the opacity of the Overlay while using the UV Editor

Diff Detail

Repository
rB Blender
Branch
opacityWireframe (branched from master)
Build Status
Buildable 4471
Build 4471: arc lint + arc unit

Event Timeline

Eitan (EitanSomething) edited the summary of this revision. (Show Details)Fri, Jul 26, 5:20 AM

Hey Eitan,

Please note that I have not yet tested this patch, so these are just from a quick view. And I barely know what I'm doing so I might be quite wrong about the following. LOL

space_image.c 588. Looks like you accidentally removed some whitespace. Not that it matters, but best to not make changes outside your intended patch.

uvedit_draw.c 354. It appears that there is a "GPUBlend(true)" at the beginning of every case in that switch. So it could be used one just before it. In fact it is also used in the section before, so you could probably put it just after "if (edges) {"

uvedit_draw.c 414 - If you look at the section around line 350 there is a condition where they are turning on GPU_blend. And later on at 414 they then use the same condition to turn it off again. The assumption is that the default state is off, so you'll want to turn in off again after you need it. To my eye it looks like you could just turn it on "if (edges)" and off again at the bottom of the block.

uvedit_draw.c 405 - This looks a bit wrong to me. In this section (originally) there is black outline and and inner line that is using colors col1 and col2, taken from theme colors (TH_WIRE_EDIT & TH_EDGE_SELECT) but in your version the inner and outer lines are both black. I think you needed to do something like col1[3] = sima->wireframe_opacity; col2[3] = sima->wireframe_opacity; and then use those colors instead.

rna_space.c, 2715. I think you want the short name of that operator to be "Wireframe Opacity", not just "Opacity", in case it is used among other similarly-named things.

Eitan (EitanSomething) planned changes to this revision.Fri, Jul 26, 3:06 PM
  • Opacity now set to 1 as default
Eitan (EitanSomething) edited the summary of this revision. (Show Details)Fri, Jul 26, 7:04 PM
Eitan (EitanSomething) edited the summary of this revision. (Show Details)Fri, Jul 26, 7:06 PM

Hey Eiten!

Looking a lot nicer! And again, take my comments only as suggestions and with a grain of salt as I have much to learn.

But I still think the variable name is a bit too unspecific. When looking at the SpaceImage struct we really want the members to be quite obvious. I would call that float "outline_opacity" or something else very specific.

I think it is a similar issue in the definition of the property. I think line 2716 in rna_space.c should be something like the following in case it is used next to thing with similar names. In this case it will display as "Overlay Opacity" by default.

RNA_def_property_ui_text(prop, "Overlay Opacity", "Opacity of overlays");

Hey Eiten!
Looking a lot nicer! And again, take my comments only as suggestions and with a grain of salt as I have much to learn.
But I still think the variable name is a bit too unspecific. When looking at the SpaceImage struct we really want the members to be quite obvious. I would call that float "outline_opacity" or something else very specific.
I think it is a similar issue in the definition of the property. I think line 2716 in rna_space.c should be something like the following in case it is used next to thing with similar names. In this case it will display as "Overlay Opacity" by default.

RNA_def_property_ui_text(prop, "Overlay Opacity", "Opacity of overlays");

How and where do you set the default value of the float to be 1.of

Eitan (EitanSomething) updated this revision to Diff 16630.EditedFri, Jul 26, 7:20 PM
  • revert set default to 1.0f
  • changed RNA_def_property_ui_text(prop, "Opacity", "Opacity of overlays"); to RNA_def_property_ui_text(prop, "Overlay Opacity", "Opacity of overlays");

@Eitan (EitanSomething) : How and where do you set the default value of the float to be 1.of

If by "default" you just mean that it starts with a value of "1" every time an Image Editor is opened, then that should just be an assignment to the "simage" var in Image_new() in space_image.c. I think.

  • Sets opacity to default when you open up new UV Editor.

This might not have been done the proper way.

  • Opacity now affects verts
  • Opacity doesn't affect selected Overlay

Checked this patch, seems like a start but there are some strange behaviors.

  • Selected wire doesn't change opacity, this could have some advantage but makes the feature seem broken when everything is selected.

    Perhaps this is useful to keep in some way, for example the wire could fade out but the vertices could keep drawing with full opacity.
  • We might limit the lowest alpha to something visible (20% or so), since we get reports occasionally from people who manage to hide things by accident, or loading files from someone else who set this value.
  • As has been mentioned the term opacity is too generic. Should probably be called uv_edge_opacity.
  • Made changes suggested by Campbell Barton
Eitan (EitanSomething) edited the summary of this revision. (Show Details)Tue, Jul 30, 8:50 PM
Eitan (EitanSomething) edited the summary of this revision. (Show Details)
  • Removed empty spaces
Eitan (EitanSomething) planned changes to this revision.Fri, Aug 2, 4:52 AM

I will update the code after T62917 is committed the this will be ready for approval.

Eitan (EitanSomething) updated this revision to Diff 17211.EditedFri, Aug 16, 10:14 PM
  • Updated after committed T62917

This is ready for review.