AnswerBun.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!

Related Questions

Some objects not showing in object mode

0  Asked on December 9, 2021 by knut

 

Reselect faces that was already selected?

2  Asked on December 6, 2021 by afws

 

Can’t Unlock from Constraint Z Axis

1  Asked on December 6, 2021 by synch-games

   

How to select one (or multi) particular particle hair?

1  Asked on December 6, 2021 by michael-white

     

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP