[Bf-taskforce25] bpy and metaballs

Brecht Van Lommel brecht at blender.org
Sun Jul 26 12:07:11 CEST 2009


Hi Jiri,

It's context.meta_ball. To debug this kind of issue, you can use 
print(dir(context)) to find out what's in the context.

Brecht.

Jirí Hnidek wrote:
> 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
> _______________________________________________
> Bf-taskforce25 mailing list
> Bf-taskforce25 at blender.org
> http://lists.blender.org/mailman/listinfo/bf-taskforce25
> 
> 



More information about the Bf-taskforce25 mailing list