TransWikia.com

vertex coordinates in panel made with python script do not update

Blender Asked by sodiumnitrate on August 29, 2020

I modified the UI panel simple template so that the coordinates of the vertices of the selected object will be listed:

class HelloWorldPanel(bpy.types.Panel):
    """Creates a Panel in the Object properties window"""
    bl_label = "Hello World Panel"
    bl_idname = "OBJECT_PT_hello"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = "object"

    def draw(self, context):
        layout = self.layout

        obj = context.object

        row = layout.row()
        row.label(text="Hello world!", icon='WORLD_DATA')

        row = layout.row()
        row.label(text="Active object is: " + obj.name)
        row = layout.row()
        row.prop(obj, "name")

        row = layout.row()
        row.operator("mesh.primitive_cube_add")
        
        vNum = len(obj.data.vertices)
        for i in range(vNum):
            v = obj.data.vertices[i].co
            layout.label("vertex " + str(i) + ": (%f %f %f)" % (v[0],v[1],v[2]))

This does print vertex coordinates in the panel:

enter image description here

However, the coordinates remain unchanged when I move the plane. How can I make the vertex coordinates update real-time?

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP