In the UI Panel layout I have:

def draw(self, context):
    layout = self.layout

    row = layout.row()
    props = row.operator("myops.addthings", text="HEAD")

    #text variable here
    props.sometext ="my object name"

In the operator I have:

sometext = bpy.props.StringProperty()
bl_description = "Add "+str(sometext)

The tool tip however doesn't seem to be displaying the "sometext" as regular string, see the screen captured as below:

enter image description here

Seems the string returns as "", what is the fix to get it displayed?

  • $\begingroup$ As far as I know this is a limitation and an operator cannot have procedural description. You have to have multiple operators for multiple tool_tips.. $\endgroup$ – Jaroslav Jerryno Novotny May 19 '18 at 9:25
  • $\begingroup$ Need to unregister and reregister class to change the tooltip. Somewhat related $\endgroup$ – batFINGER May 19 '18 at 9:31
  • $\begingroup$ I was hoping to make an operator that works with different buttons to add different mesh by retrieving the variables in the layout correspondingly ... so this cannot be done? I have to make an operator for each? $\endgroup$ – adrian li May 19 '18 at 9:44

Your Answer

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

Browse other questions tagged or ask your own question.