Post #4530: Hello. I’m trying to create a slider for “Vertex Crease”, so I edited the file p

📋 Metadata

  • Author: Nanomanpro
  • Date: 2022-09-09 10:05:10
  • Type: question
  • Quality Score: 6/10

🏷️ Tags

v1-18-7 pie-menu custom-properties intermediate unsolved

  • Pie Menu Editor
  • Property Editor
  • Python Scripting
  • Custom Float Properties

💬 Content

Hello. I’m trying to create a slider for “Vertex Crease”, so I edited the file posted by roaoao in the thread below replacing the word “edges” with “vertices” but that doesn’t work :slight_smile:
Here is the code, so I would like to ask for help. Thank you

Pie Menu Editor 1.18.7 Released Scripts and Themes

We don’t have access to these buttons from python. But you can create your own. Add Float Properties with these getter and setter (edge_crease_and_bevel_weight.json): Edge Bevel Weight Getter: import bmesh; obj = C.edit_object; me = obj and obj.type == ‘MESH’ and obj.data; bm = me and bmesh.from_edit_mesh(me); l = me and bm.edges.layers.bevel_weight.verify(); e = me and find_by(bm.edges, “select”, True); return e[l] if e else 0 Edge Bevel Weight Setter: import bmesh; obj = C.edit_object; me…

My edited code:

{
  "version": "1.15.16", 
  "menus": [
    [
      "Vertex Crease", 
      "Window", 
      "", 
      [
        [
          "GET", 
          "COMMAND", 
          "", 
          "import bmesh; obj = C.edit_object; me = obj and obj.type == 'MESH' and obj.data; bm = me and bmesh.from_edit_mesh(me); l = me and bm.vertices.layers.crease.verify(); e = me and find_by(bm.vertices, \"select\", True); return e[l] if e else 0"
        ], 
        [
          "min", 
          "", 
          "0.0"
        ], 
        [
          "max", 
          "", 
          "1.0"
        ], 
        [
          "SET", 
          "COMMAND", 
          "", 
          "import bmesh; obj = C.edit_object; me = obj and obj.type == 'MESH' and obj.data; bm = me and bmesh.from_edit_mesh(me); l = me and bm.vertices.layers.crease.verify(); me and [e.__setitem__(l, value) for e in bm.vertices if e.select]; me and bmesh.update_edit_mesh(me)"
        ], 
        [
          "step", 
          "", 
          "5.0"
        ]
      ], 
      "PROPERTY", 
      "prop?", 
      "PRESS", 
      "FLOAT", 
      "Examples"
    ]
}

🔗 View on Blender Artists