[Bf-taskforce25] bpy and metaballs

Jiří Hnídek jiri.hnidek at tul.cz
Sun Jul 26 12:39:39 CEST 2009


Hi Brecht,
thanks for advice. It works now :-). Of course, I tried to  
print(dir(context)), but it prints only this:

['BoolProperty', 'FloatProperty', 'IntProperty', 'StringProperty',  
'__class__', '__delattr__', '__dict__', '__dir__', '__doc__',  
'__eq__', '__ge__', '__getattribute__', '__gt__', '__hash__',  
'__init__', '__le__', '__lt__', '__module__', '__ne__', '__new__',  
'__reduce__', '__reduce_ex__', '__repr__', '__rna__', '__setattr__',  
'__str__', '__weakref__', 'keyframe_insert']

I still use python 2.6 ... is this problem?

Jiri

On 26.7.2009, at 12:07, Brecht Van Lommel wrote:

> 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
>>
>>
>
> _______________________________________________
> 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