开发者

How do I create UI "input fields" in Panel (3D Blender 2.55)?

开发者 https://www.devze.com 2023-01-26 06:12 出处:网络
I\'m trying to create my own panel (in Blender 2.55), that will help me modify/create objects. I\'ve tried the following example:

I'm trying to create my own panel (in Blender 2.55), that will help me modify/create objects.

I've tried the following example:

import bpy

class OBJECT_PT_My_Panel(bpy.types.Panel):
    bl_label = "My Panel Test 1"
    bl_region_type = "WINDOW"
    bl_space_type = "PROPERTIES"
    bl_context = "object"

    height = bpy.props.IntProperty(attr="height")

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

        row = layout.row()
        row.prop(self, "height")

But it fails :(

Console:

rna_uiItemR: property not found: OBJECT_PT_My_Panel.height

This one also fails:

import bpy

class OBJECT_PT_My_Panel(bpy.types.Panel):
    bl_label = "My Panel Test 1"
    bl_region_type = "WINDOW"
    bl_space_type = "PROPERTIES"
    bl_context = "object"

    _height = 1

    def height_getter(self):
        return self._height

    def height_setter(self, value):
        self._height = value

    height = property(fget = height_getter, fset = height_setter)

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

        row = layout.row()
        row.prop(self, "height")

Console:

rna_uiItemR: property not found: OBJECT_PT_My_Panel.height

All the examples that I've found, are using existing开发者_开发问答 properties like object.name, object.location etc..

I couldn't find any related documentation. What can i do?

Thanks,

Amir.


Your problem may have already been solved, but if not this link may help you.

Code snippets. Introduction to Python scripting in Blender 2.5x http://blenderartists.org/forum/showthread.php?t=193908

Hope that helps

0

精彩评论

暂无评论...
验证码 换一张
取 消