I want to use mean crease in my python script, but i cant access its code via "edit source". I need a button which clears all creases on selected edges with single click, and put it in my custom pie menu. I've found some info on it : mean crease function is scripted with C. Any ideas how to get "mean crease" in python?
Here is the line you need
bpy.ops.transform.edge_crease(value=-1.0)
import bpy
class UIPanel(bpy.types.Panel):
bl_label = "Crease Clear"
bl_space_type = "VIEW_3D"
bl_region_type = "UI"
@classmethod
def poll(cls, context):
return (context.active_object is not None) and (context.mode == "EDIT_MESH")
def draw(self, context):
self.layout.operator("crease.clear", text='Crease Clear')
class OBJECT_OT_HelloButton(bpy.types.Operator):
bl_idname = "crease.clear"
bl_label = "Crease Clear"
country = bpy.props.StringProperty()
def execute(self, context):
bpy.ops.transform.edge_crease(value=-1.0)
return{'FINISHED'}
bpy.utils.register_module(__name__)
Если ты хочешь чтобы кнопка осталась в системе, после перезапуска блендера, сохрани текст в файл с форматом .py и нажми последовательно эти кнопки
If you want the button to remain in the system, after restarting the blender, save the text in a file with the format .py and click these buttons sequentially
-
$\begingroup$ Thx alot. This code works for pie menu's too. Thats what i was looking for. $\endgroup$ – Евгений Гейзер May 9 '17 at 15:56
obj.data.edges.crease
. While in edit mode you would need to usebmesh.from_edit_mesh()
and get the edge crease from the custom data layers. $\endgroup$ – sambler Apr 11 '17 at 4:58