Hot answers tagged

13

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 arrow button next to the list and choose Cleanup.


10

Reports to text block operator bpy.ops.ui.reports_to_textblock() . The operator bpy.ops.ui.reports_to_textblock() lists reports from the info area into a text block named "Recent Reports"([.nnn] if run more than once.) Test code. Removes existing recent reports before running operator. #remove other Recent Reports reports = [bpy.data.texts.remove(t, ...


10

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 panels. 1. Panel Blender comes with a few UI templates (Text Editor > Templates > UI ...) . I'd suggest start with UI Panel Simple ui_panel_simple.py and use it ...


9

In you specific case, the bl_context you are looking for is sculpt_mode. There are many others including: objectmode mesh_edit curve_edit surface_edit text_edit armature_edit mball_edit lattice_edit pose_mode imagepaint weightpaint vertexpaint particlemode


7

It's named "testprop" not "test_float" When a property defined via bpy.types.Scene.test_float = bpy.props.FloatProperty(...) is assigned a value scene.test_float = value it is stored. "behind the scenes" as a custom property scene["test_float"] ("second time above") In the get / set example ("first time above") it is instead stored in a custom property ...


7

UILayout.use_property_split and UILayout.use_property_decorate Setting UILayout.use_property_split in conjunction with UILayout.use_property_decorate to True, marks down the animation button. (Currently not over-documented) My understanding is the split makes room for it, and the decorate draws it. With developer extras on, right click > view source. ...


6

Another solution is to use python's textwrap module: import textwrap textTowrap = "Your text......................................" wrapp = textwrap.TextWrapper(width=50) #50 = maximum length wList = wrapp.wrap(text=textTowrap) #Now in the panel: for text in wList: row = layout.row(align = True) row.alignment = 'EXPAND' row....


6

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, like this: def wrap(width, text): lines = [] arr = text.split() lengthSum = 0 strSum = "" for var in arr: lengthSum+=len(var) + 1 if ...


6

@classmethod def poll(cls, context): return len(context.selected_objects) == 2


6

Add draw_header(context) function to your Panel class and supply any bool property. Following example is based on ui_panel_simple.py template: import bpy class HelloWorldPanel(bpy.types.Panel): """Creates a Panel in the Object properties window""" bl_label = "Hello World Panel" bl_idname = "...


6

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 don't indicate any changes around this.) The requirements are simply: Your operator's bl_options must include 'REGISTER' and 'UNDO'. (Register indicates to ...


5

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 window as part of a popup. I've removed all superfluous operators and added a CUSTOM_OT_popup operator calling invoke_props_dialog in its invoke method as well as a ...


5

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 member available when the object is not a speaker it will be none. class HelloWorldPanel(bpy.types.Panel): """Creates a Panel in the Object properties window""" ...


4

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: cls = getattr(bpy.types, "VIEW3D_PT_view3d_display") Note that bpy_types.TypeMap is part of Blenders internal logic which you're not meant to touch! :)


4

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 automatically draw a button to call your menu without declaring any extra operator by layout.operator("wm.call_menu").name="menu_identifier". The layout code is ripped from How to ...


4

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 doesn't even show when running via the search menu (F3) In invoke you need to register yourself as modal context.window_manager.modal_handler_add(self) invoke needs to return {'RUNNING_MODAL'} ...


4

Just set layout.use_property_split property in your draw method to True: def draw(self, context): layout = self.layout layout.use_property_split = True layout.use_property_decorate = False # No animation. ... Custom Panel Example based on the add-on template from: How to create a custom UI? bl_info = { "name": "Add-on ...


3

Operator options show up in the Redo Panel after the operator has been executed. If the operator is cancelled instead of confirmed, no options will appear as no operator has been run (even though an operator was started). Your screenshot shows the operator is running, but not yet finished/confirmed.


3

Setting bl_space_type = 'VIEW_3D' will place your panel within the 3dview. You then set bl_region_type = 'TOOLS' to have it show in the tools region while the less intuitive bl_region_type = 'UI' places it in the properties region. If you want to place a panel in the properties editor, you would set bl_space_type = 'PROPERTIES' and bl_region_type = 'WINDOW',...


3

To create a custom panel you subclass bpy.types.Panel and set the space, region and context to suit. Setting the space and region to PROPERTIES and WINDOW will place the panel within the properties. Without a context it will show in every section, object will place it only in the object properties. class testPanel(bpy.types.Panel): bl_label = "Test ...


3

scene['Object_type'] will refer to a custom property you have added to a scene either by using the Custom Properties panel in the scene properties or by blender automatically creating it as you used scene['Object_type'] = 2 in your script or the python console. The proper way to create a new property for your addon to use is by using bpy.props. In your ...


3

Drag the signs at the corner of each window in following directions.It will help you close all the windows.


3

While there is a small python script that handles the header and menus for the outliner, most of the outliner drawing is handled in C source files. This means that customising the outliner appearance requires a custom build of blender, though you can add menus as shown here. I would suggest you keep using the panel in the properties editor that you have ...


3

Scene.material_slots If I understand question you want to display all the materials used by all the objects in the scene. Every bpy.types.Object has a material slots collection, a scene does not. Added a material slots collection to the scene. Used an old fashioned python property to populate Scene.materials from the non None materials on the objects in ...


3

Adding to already registered panels As an extra to other answers re defining a draw header on a new panel class, can monkey around with existing panel classes. Here is an example that adds gravity checkbox and "XXX" to audio panel header, and disables that panels layout with scene.use_gravity (silly) import bpy from bl_ui.properties_scene import ...


3

There are two things necessary to set the fullscreen mode successfully: Wait for the workspace to be switched Create a custom context for the operator The first part can be accomplished by adding an application handler that is triggered after the dependency graph is updated. The second part is necessary to set the correct area to fullscreen. This can be ...


3

Edit : Make sure you are using a mouse with right-click capability. Right click on the tab and choose Delete If the popup doesn't appear then there is something wrong with your installation or this is a bug. You might try resetting Blender to factory settings or there is a hidden feature I do not know in the preferences to disable it... To reset to ...


3

Mix in class Following on from your answer, can also create a mix in class. An example below. The EeveeBasePanel mix in class will make any panel inheriting it be in properties, render context, default closed and poll when the render engine is eevee. This comes in handy if you are going to register other panels. For example I have put a test panel in ...


3

Poll the panel Given this from the question When a combination of items are chosen in another panel, I want this panel to appear, but not otherwise. Right now the panel will always show after being registered. I browsed through the documentation and found nothing useful. What function can I call or flag can I set to show and hide a panel, to not show a ...


3

Reuse the code. Can turn on developer extras and view the source of most of blenders UI. An option would be to copy the code needed and add to a new Panel class. A rub is the properties area often has context members unique to the region. For this case context.particle_system is defined in the properties area in particles tab. Would instead need to be ...


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