Set Brush operator
2.1.2 - added: `gp.brush_set` operator to manually assign a brush by name to a shortcut - preferably add shortcut to `Grease Pencil > Grease Pencil Stroke Paint Mode`
This commit is contained in:
		
							parent
							
								
									bf30254871
								
							
						
					
					
						commit
						b2a6e6a899
					
				
							
								
								
									
										11
									
								
								CHANGELOG.md
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								CHANGELOG.md
									
									
									
									
									
								
							| @ -1,5 +1,16 @@ | |||||||
| # Changelog | # Changelog | ||||||
| 
 | 
 | ||||||
|  | 2.1.2 | ||||||
|  | 
 | ||||||
|  | - added: `gp.brush_set` operator to manually assign a brush by name to a shortcut | ||||||
|  |   - preferably add shortcut to `Grease Pencil > Grease Pencil Stroke Paint Mode` | ||||||
|  | 
 | ||||||
|  | 2.1.1 | ||||||
|  | 
 | ||||||
|  | - added: follow curve show offset property in UI | ||||||
|  | - added: follow curve show clickable warning if object has non-zero location to reset location | ||||||
|  | - changed: created follow curve use `fixed offset` | ||||||
|  | 
 | ||||||
| 2.1.1 | 2.1.1 | ||||||
| 
 | 
 | ||||||
| - added: follow curve show offset property in UI | - added: follow curve show offset property in UI | ||||||
|  | |||||||
| @ -48,6 +48,26 @@ class GPTB_OT_load_brushes(bpy.types.Operator, ImportHelper): | |||||||
|         return {"FINISHED"} |         return {"FINISHED"} | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | class GPTB_OT_brush_set(bpy.types.Operator): | ||||||
|  |     bl_idname = "gp.brush_set" | ||||||
|  |     bl_label = "Set Brush" | ||||||
|  |     bl_description = "Set Gpencil brush" | ||||||
|  |     bl_options = {"REGISTER", "UNDO"} | ||||||
|  | 
 | ||||||
|  |     brush_name : bpy.props.StringProperty(name='Brush', description='Name of the brush to use') | ||||||
|  | 
 | ||||||
|  |     @classmethod | ||||||
|  |     def poll(cls, context): | ||||||
|  |         return context.object and context.mode == 'PAINT_GPENCIL' | ||||||
|  | 
 | ||||||
|  |     def execute(self, context): | ||||||
|  |         brush = bpy.data.brushes.get(self.brush_name) | ||||||
|  |         if not brush: | ||||||
|  |             self.report({'ERROR'}, f'Brush "{self.brush_name}" not found') | ||||||
|  |             return {"CANCELLED"} | ||||||
|  |         context.scene.tool_settings.gpencil_paint.brush = brush | ||||||
|  |         return {"FINISHED"} | ||||||
|  | 
 | ||||||
| ### -- MENU ENTRY -- | ### -- MENU ENTRY -- | ||||||
| 
 | 
 | ||||||
| def load_brush_ui(self, context): | def load_brush_ui(self, context): | ||||||
| @ -62,6 +82,7 @@ def load_brush_top_bar_ui(self, context): | |||||||
| 
 | 
 | ||||||
| classes = ( | classes = ( | ||||||
| GPTB_OT_load_brushes, | GPTB_OT_load_brushes, | ||||||
|  | GPTB_OT_brush_set, | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| def register(): | def register(): | ||||||
|  | |||||||
| @ -4,7 +4,7 @@ bl_info = { | |||||||
| "name": "GP toolbox", | "name": "GP toolbox", | ||||||
| "description": "Tool set for Grease Pencil in animation production", | "description": "Tool set for Grease Pencil in animation production", | ||||||
| "author": "Samuel Bernou, Christophe Seux", | "author": "Samuel Bernou, Christophe Seux", | ||||||
| "version": (2, 1, 1), | "version": (2, 1, 2), | ||||||
| "blender": (3, 0, 0), | "blender": (3, 0, 0), | ||||||
| "location": "Sidebar (N menu) > Gpencil > Toolbox / Gpencil properties", | "location": "Sidebar (N menu) > Gpencil > Toolbox / Gpencil properties", | ||||||
| "warning": "", | "warning": "", | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user