3
$\begingroup$

I can draw the control shown below on a panel using:

col = self.layout.column(align=True)
col.prop(bpy.context.scene.display, "light_direction")

But, the minute I try and add any sort of param, the whole control disappears. How can I remove the "Light Direction" label on the sphere?

enter image description here

$\endgroup$
5
$\begingroup$

Set the text argument.

As with all properties in blender, can set the text argument to display something other than the property name, (the default)

enter image description here

def draw(self, context):
    scene = context.scene
    col = self.layout.column(align=True)
    col.prop(scene.display, "light_direction", text="")

Also note the usage of context as passed to the draw method, rather than using bpy.context

$\endgroup$
2
  • $\begingroup$ Thanks so much! Is context.scene different from bpy.context.scene ? $\endgroup$ Aug 2 '21 at 8:11
  • 1
    $\begingroup$ Thankyou. Re context: No. It is generally the case that the context passed is same. IMO simply good practice to use the argument provided, just in case there are changes in the future. Outside scope of this question, the possibility for future as I see it is , can pass an overridden context to an operator. Would be handy to know from within the operator what is "real" context and what is "fake". $\endgroup$
    – batFINGER
    Aug 2 '21 at 8:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.