[Bf-taskforce25] bpy and metaballs
Jiří Hnídek
jiri.hnidek at tul.cz
Sun Jul 26 11:57:05 CEST 2009
Hi,
I would like to add panels for metaballs to button window, but I have
some poblems. I added Python script buttons_data_metaball.py to
release/ui/ directory:
import bpy
class DataButtonsPanel(bpy.types.Panel):
__space_type__ = "BUTTONS_WINDOW"
__region_type__ = "WINDOW"
__context__ = "data"
def poll(self, context):
# metaball or mball or something else?
return (context.metaball != None)
class DATA_PT_context_metaball(DataButtonsPanel):
__idname__ = "DATA_PT_context_metaball"
__show_header__ = False
def draw(self, context):
layout = self.layout
ob = context.object
mball = context.metaball
space = context.space_data
split = layout.split(percentage=0.65)
if ob:
split.template_ID(ob, "data")
split.itemS()
elif mball:
split.template_ID(space, "pin_id")
split.itemS()
class DATA_PT_metaball(DataButtonsPanel):
__idname__ = "DATA_PT_metaball"
__label__ = "Metaball"
def draw(self, context):
layout = self.layout
bpy.types.register(DATA_PT_context_metaball)
bpy.types.register(DATA_PT_metaball)
Script is automagicaly executed, when metaball object is selected, but
it doesn't show anything. I guess, that there is some problem with
creating context for metaball. Can anybody help me?
Thanks,
Jiri
More information about the Bf-taskforce25
mailing list