Hi just using Blender 2.6, seem the custom operators aren't working for me...
Just tested with the pingpong script
# version 1.3.0
# tested on 31315
bl_space_type = "PROPERTIES"
bl_region_type = "WINDOW"
bl_context = "object"
bl_label = "Ping Pong"
display = 0
def draw_header(self, context):
layout = self.layout
def draw(self, context):
layout = self.layout
row = layout.row()
split = row.split(percentage=0.5)
colL = split.column()
colR = split.column()
if self.display == 0:
This is all i get:
all my custom buttons are doing the same, just the txt and nothing to click. Any ideas? Is this 2.6 problem?
lol! sorry my bad....shoulda put the whole script. "pipo" is the class (Operator) id_name
bl_label = "PingPong operator"
bl_idname = "pipo"
bl_description = "Move the ball"
def invoke(self, context, event):
self.report("INFO", "Moving the ball")
bpy.types.OBJECT_PT_pingpong.display = 1 - bpy.types.OBJECT_PT_pingpong.display
thats what the previous def calls on.
Your bl_idname probably needs a prefix which is one of the valid subcategories defined in bpy.ops, e.g. “object.pipo” rather than just “pipo”.
Also I wouldn’t bother giving your class a magic xx
-type name—it serves no purpose.
Hmm that didnt work for me, im wondering do i have to register the operator class as well?
Well anyway that didnt work either. Its strange if i use any of the operators already created e.g. "object.armature_add" then it pops out a button with any problemos.
Seems rather wierd was working on previous versions.
fully agree with the whole magic thing...i wondered why so many people were doing that? Never used it in the past. Seems a bit convoluted to me
Well if anyone has had any luck with creating their own operators and having it run as a button would be keen to see your script
Yes, you have to register your operators. You want to see some sample code that works? Have a lookt at this: https://github.com/ldo/gimp_palettes_for_blender
If you want a button example try this one: https://github.com/ldo/treadtiler
thanks peeps! mustv typed something wrong i tried again with register and it worked. Also had to have the operator sub category as well