hey guys, in an attempt to learn scripting in blender and I have a few questions. I am looking at the panel_simple.py script
import bpy class OBJECT_PT_hello(bpy.types.Panel): bl_label = "Hello World Panel" bl_space_type = "PROPERTIES" bl_region_type = "WINDOW" bl_context = "object" def draw(self, context): layout = self.layout obj = context.object row = layout.row() row.label(text="Hello world!", icon='WORLD_DATA') row = layout.row() row.label(text="Active object is: " + obj.name) row = layout.row() row.prop(obj, "name")
1st question is: does a function not have to be called? for example I see the draw function being defined but never called. Is it considered a constructor in this case and just called automatically when we run he script since it is the 1st (and only) function in the class?
def draw(self, context):
what exactly is context referring to?
3rd question: And if this is a constructor type situation, why do we place anything in the parenthesis for the function definition, since we are not actually calling the function and thus not passing any parameters?
Sorry for my ignorance but I could not seem to find a direct answer to that last question in python documentation.