0

I'm trying to add the Line art crease angle to my viewport panel. I thought it should be fairly straightforward. When I change it to 180 degrees using the slider control I get this in the console area:

bpy.context.object.grease_pencil_modifiers["Line Art"].crease_threshold = 3.14159

Of course the value is in radians and not degrees, but the slider display is in degrees. All well and good. But when I place in in a panel thusly:

col.prop(bpy.data.objects["Line Art Thin"].grease_pencil_modifiers["Line Art"], "crease_threshold")

I get a nice control, which has the degrees shown, and I can manually enter the value by typing in it, but the slider control does not work. What is the best way to remedy this situation?

Emir
  • 5,701
  • 1
  • 14
  • 31
chippwalters
  • 600
  • 3
  • 15
  • 1
    Probable dupe https://blender.stackexchange.com/questions/112196/how-to-make-a-python-operator-as-a-slider-scripting-an-addon/112209#112209 – batFINGER Jul 30 '21 at 03:13

1 Answers1

1

Thanks to batfinger for pointing me to that link. The answer is straightforward:

col.prop(bpy.data.objects["Line Art Thin"].grease_pencil_modifiers["Line Art"], "crease_threshold", slider=True)

It needed to have the slider=True appended.

chippwalters
  • 600
  • 3
  • 15
  • Possibly worth mentioning that this works because the property is a 'ROTATION' type. If the scene unit designated to rotations is degrees (default) it will display as degrees. – batFINGER Jul 30 '21 at 10:56