Hot answers tagged

11

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, ...


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

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 ...


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

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


6

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. ...


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

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


4

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 = "...


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

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 ...


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

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


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

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 ...


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 ...


3

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

Easy. You would have to assign the PointerProperty to bpy.types.Object. Use context.object to get a reference. Demo based on the template from How to create a custom UI? import bpy from bpy.props import (StringProperty, BoolProperty, IntProperty, FloatProperty, ...


3

"Whack" em all. Script will "whack" (unregister) any registered Panel, Menu or Header class that follows the naming convention. import bpy classes_to_whack = ( getattr(bpy.types, p) for p in dir(bpy.types) if any( sep in p for sep in ("_PT_", "_HT_", "_MT_") ...


3

Given a defined enumerated list: proplist: bpy.props.EnumProperty( items=(("BoolProperty", "Bool", "Boolean"), ("BoolVectorProperty", "Bool", "Boolean"), # duplicate name, desc ("FloatProperty", "Float", "Floating Point"), ("FloatVectorProperty"...


3

Override the context. TBH can't see why this is not working, the properties panel can be fickle, for example with context.object Suggest two changes, make an override dictionary to be sure to be sure the object known as ob is the one having its modifier applied. Secondly using mod.name to identify the modifier ensures it is the last one added, in case the ...


2

You can save your current file, including preferences and window layout as startup file by selecting File > Save Startup File or hitting Ctrl + U


2

I resolved my problem finally, i'm just going to share the solution in case of someone has the same issue the error was coming from the definition of the parent bone and the child one. Because I am in edit mode, I have to define them in the armature and not in the object. So instead of pbone = bpy.context.object.data.edit_bones['%s'%parent] the correct ...


2

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 ...


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