Hot answers tagged

14 votes

Wrap text within a panel

Another solution is to use python's textwrap module: ...
Noob Cat's user avatar
  • 1,192
13 votes
Accepted

How to delete greyed out Bookmarks and Recents?

You can delete greyed out Bookmarks but not Recent. Recent will just go away after a while or you could delete all of them by clicking X button next to the list. To clear bookmarks list click on ...
cgslav's user avatar
  • 17.5k
12 votes

When declaring a panel, what does the 'bl_context' value need to be?

As this is not well documented you could query all existing panel properties like this: ...
Mackraken's user avatar
  • 221
12 votes
Accepted

How to create a button on the n-panel?

I suggest start here: How to create a custom UI? To extend the Properties Area of the 3D View you can either register a custom panel to add UI elements onto or you can append elements to existing ...
brockmann's user avatar
  • 12.6k
10 votes
Accepted

How do I get the Info window's log text with Python?

Reports to text block operator bpy.ops.ui.reports_to_textblock() . The operator bpy.ops.ui.reports_to_textblock() lists ...
batFINGER's user avatar
  • 84k
10 votes
Accepted

When declaring a panel, what does the 'bl_context' value need to be?

In you specific case, the bl_context you are looking for is sculpt_mode. There are many others including: ...
cmomoney's user avatar
  • 2,650
9 votes
Accepted

How to display the "animate property" diamond keyframe insert button (2.8x)

UILayout.use_property_split and UILayout.use_property_decorate Setting ...
batFINGER's user avatar
  • 84k
8 votes
Accepted

Wrap text within a panel

I know I'am answering my own question, because I knew how to do it only after posting the question, so for anyone who may need this answer here it goes. I used a wrap function that I made my self, ...
Hamza Al Omari's user avatar
8 votes
Accepted

Poll method for custom panel

@classmethod def poll(cls, context): return len(context.selected_objects) == 2
batFINGER's user avatar
  • 84k
8 votes

Internal "get/set" function of property?

It's named "testprop" not "test_float" When a property defined via bpy.types.Scene.test_float = bpy.props.FloatProperty(...) is assigned a value ...
batFINGER's user avatar
  • 84k
8 votes

How to make custom "create options" panel in bottom left

This does what I wanted. There are 5 things needed to make it work: Your operator needs bl_options = {'REGISTER', 'UNDO'}, without this the operator properties UI ...
mountainstorm's user avatar
8 votes
Accepted

Blender Python Addon doesn't unregister (registers fine)

Your main problem is your bl_info structure. You can read about it in the Blender official wiki Here's a corrected version: ...
Marty Fouts's user avatar
7 votes

How to make custom "create options" panel in bottom left

While mountainstorm's answer is functional, you actually don't need so much to get the redo UI to show up. (At least not in Blender 2.9 - I haven't tried this in earlier versions but the release notes ...
Chris Hayes's user avatar
7 votes
Accepted

show_bones as a Boolean property on custom panel

The python tooltip is really misleading. The bpy.types.View3DOverlay object is actually a member of bpy.types.SpaceView3D. Also the bpy.types.UILayout.prop method only support direct attribute access, ...
Gorgious's user avatar
  • 30.4k
6 votes
Accepted

How to add a checkbox to a panel header?

Add draw_header(context) function to your Panel class and supply any bool property. ...
brockmann's user avatar
  • 12.6k
6 votes
Accepted

How to assign PointerProperty in Operator through UI?

Aafter continuing researching, apparently operators can only take basic properties (e.g. string, bool, int, float, collections of the property types just mentioned), and PointerProperties only work if ...
S. Magnusson's user avatar
  • 1,493
6 votes
Accepted

How to control spacing/alignment of Label + Horizontal Enum Property?

Just set layout.use_property_split property in your draw method to True: ...
brockmann's user avatar
  • 12.6k
6 votes
Accepted

Is there a workaround for the known bug in dynamic EnumProperty?

The Warning in the documentation states the EnumProperty should have a permanent handle on the items. There is a known bug with using a callback, Python must keep ...
Gorgious's user avatar
  • 30.4k
6 votes

Display preset RGB values in a panel (and call function when clicked)

Have a look into How do i create Palette UI object and How to get a specific color/slot from a Color Palette Quickly combined the code of both answers to display 50 random generated colors and their ...
pyCod3R's user avatar
  • 1,906
6 votes
Accepted

How to display a fixed list of RGB values in a panel and when a color is clicked call an operator

As has been mentioned elsewhere, template_palette is implemented in C as uiTemplatePalette and that function does not take any ...
Marty Fouts's user avatar
5 votes

How do I get the Info window's log text with Python?

As of Blender version 2.81, bpy.ops.ui.reports_to_textblock was removed, (see D5510) because the functionality to read Info was already available through the ...
Marty Fouts's user avatar
5 votes

How to nest sub panels and submenus on the TOOLS panel (T)?

You can declare as many menus as you like and concatenate them by calling each menu within the previous menu by layout.menu(menu_identifier). You can even ...
brockmann's user avatar
  • 12.6k
5 votes
Accepted

How to populate UIList with all material slot in scene? 2.8

Scene.material_slots If I understand question you want to display all the materials used by all the objects in the scene. Every ...
batFINGER's user avatar
  • 84k
5 votes
Accepted

Is there a way to display a multi-lines message in panel / popup?

Example using an UIList based on the answer of Create an interface which is similar to the material list box? and my modification for Displaying text inside an addon Panel to get some kind of log ...
brockmann's user avatar
  • 12.6k
5 votes
Accepted

Is it possible to change the active bl_category with python?

Search registered classes. To get all the classes in bpy.types that are a subclass of bpy.types.Panel and ...
batFINGER's user avatar
  • 84k
5 votes

how to ad a panel in the properties/data Speaker specific

Add a poll method. To narrow it down could look to see if context object is of type 'SPEAKER' or since it is in the properties space, there is a speaker context ...
batFINGER's user avatar
  • 84k
5 votes
Accepted

How can I add a panel to the properties area of the file browser?

You would have to add a draw() method along with a pass statement to the operator in order to skip drawing and declare a ...
brockmann's user avatar
  • 12.6k
5 votes
Accepted

Warning: 'CLASS_NAME' doesn't have upper case alpha-numeric prefix

The part before _PT_ must be uppercase alphanumeric to suppress the message (no special characters). You can use whatever for the part after it though, ...
Gorgious's user avatar
  • 30.4k
4 votes

How to reference a particular Panel used in the ui?

You can get the panel in a single operation but not by label, since panels labels aren't necessarily unique, you should use the panel name. eg: ...
ideasman42's user avatar
  • 47.3k
4 votes
Accepted

How to compile template_list with some object in scene 2.8

Edit of previous. From the related answer to one of your previous question, edited to display all objects in the scene collection. (Class names still reflect material based nature of original) ...
batFINGER's user avatar
  • 84k

Only top scored, non community-wiki answers of a minimum length are eligible