Fix Python operator templates are not accessible from menus #90866

Closed
opened 2021-08-23 10:26:50 +02:00 by Philipp Oeser · 9 comments
Member

This addresses:

In #74157#1208583, @cessen wrote:
I'd like to second what @alefor above said:

The Python operator templates (such as operator_simple.py in the text editor's "Templates" menu ) should be updated to include the minimal code needed to make the operator accessible to the user.

Just defining an operator isn't useful if it can't be accessed, and that makes those templates a bit of an educational stumbling block now. It also makes them no longer nearly as useful as a starting point for just knocking out a custom operator quickly.

This addresses: > In #74157#1208583, @cessen wrote: > I'd like to second what @alefor above said: > > The Python operator templates (such as operator_simple.py in the text editor's "Templates" menu ) should be updated to include the minimal code needed to make the operator accessible to the user. > > Just defining an operator isn't useful if it can't be accessed, and that makes those templates a bit of an educational stumbling block now. It also makes them no longer nearly as useful as a starting point for just knocking out a custom operator quickly.
Author
Member

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Author
Member

Added subscribers: @alefor, @cessen, @lichtwerk, @ideasman42

Added subscribers: @alefor, @cessen, @lichtwerk, @ideasman42
Philipp Oeser self-assigned this 2021-08-23 10:27:05 +02:00
Member

Added subscriber: @Blendify

Added subscriber: @Blendify
Member

Not really a documentation issue, I have already updated the documentation here to recommend developers enable developer extras to go around this issue.

Not really a documentation issue, I have already updated the documentation here to recommend developers enable developer extras to go around this issue.

Added subscriber: @Tha_Hobbist

Added subscriber: @Tha_Hobbist

Hello, I'm new to blender development community and I would like to work on this issue to get started. Some guidance will be useful.

Hello, I'm new to blender development community and I would like to work on this issue to get started. Some guidance will be useful.
Author
Member

Hi @Tha_Hobbist and thx for interest in contributing.

So you would go over all the operators in
https://developer.blender.org/diffusion/B/browse/master/doc/python_api/examples/
https://developer.blender.org/diffusion/B/browse/master/release/scripts/templates_py/
and make sure the all show up in some suiting menu (and thus in {key F3} search as well)
Adding a comment like "Add to the "XYZ" menu, use F3 search "ZXY" for quick access" could help, too.

For an example of how this works, have a look at operator_file_export.py
So there are these parts to it:

def menu_func_export(self, context):
    self.layout.operator(ExportSomeData.bl_idname, text="Text Export Operator")

pick a menu this should be added to when registering:

bpy.types.TOPBAR_MT_file_export.append(menu_func_export)

and remove when unregistering.

Then put up a patch here (See https://wiki.blender.org/wiki/Process/Contributing_Code also)

Hi @Tha_Hobbist and thx for interest in contributing. So you would go over all the operators in https://developer.blender.org/diffusion/B/browse/master/doc/python_api/examples/ https://developer.blender.org/diffusion/B/browse/master/release/scripts/templates_py/ and make sure the all show up in some suiting menu (and thus in {key F3} search as well) Adding a comment like "Add to the "XYZ" menu, use F3 search "ZXY" for quick access" could help, too. For an example of how this works, have a look at `operator_file_export.py` So there are these parts to it: ``` def menu_func_export(self, context): self.layout.operator(ExportSomeData.bl_idname, text="Text Export Operator") ``` pick a menu this should be added to when registering: ``` bpy.types.TOPBAR_MT_file_export.append(menu_func_export) ``` and remove when unregistering. Then put up a patch here (See https://wiki.blender.org/wiki/Process/Contributing_Code also)
Philipp Oeser removed their assignment 2021-11-02 08:56:28 +01:00
Diptangshu Dey was assigned by Philipp Oeser 2021-11-02 08:56:28 +01:00

This issue was referenced by da14a482f2

This issue was referenced by da14a482f281e8d330ef5210ef22335a43eb726c
Author
Member

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Thomas Dinges added this to the 3.0 milestone 2023-02-08 15:59:05 +01:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#90866
No description provided.