0
$\begingroup$

Following code adds wm.save_homefile operator to the Render menu.

import bpy

def menu_draw(self, context):
    self.layout.operator("wm.save_homefile")

bpy.types.TOPBAR_MT_render.append(menu_draw)

Q: How can I add this operator to Object menu of the 3d View?

$\endgroup$
  • $\begingroup$ @batFINGER thanks for edit, but you don't help me, as i said, i really bad to make question, and my english is the worst, we know that... $\endgroup$ – flobo02 May 30 at 13:45
  • $\begingroup$ @batFINGER agradezco tus correcciones, pero realmente no me ayudan en nada, como dije anteriormente soy muy malo para hacer preguntas, y mi ingles es el peor, eso ya lo sabemos.. $\endgroup$ – flobo02 May 30 at 13:48
  • $\begingroup$ Related: How to add a custom object entry to the add menu? $\endgroup$ – brockmann Jun 1 at 15:12
0
$\begingroup$

Following code adds the open file operator and a label to three different places:

import bpy

def custom_draw(self, context):
    self.layout.operator("wm.open_mainfile")
    self.layout.label(text="Hello world!", icon='WORLD_DATA')

bpy.types.VIEW3D_MT_object.append(custom_draw) # Object menu
bpy.types.VIEW3D_MT_snap.append(custom_draw)   # Snap menu
bpy.types.TOPBAR_MT_render.append(custom_draw) # Render menu

https://docs.blender.org/api/current/bpy.types.Menu.html?highlight=prepend#extending-menus

| improve this answer | |
$\endgroup$
  • $\begingroup$ I think it is time for the administrator, moderators and experienced people to review the way in which the forum works with the new members. There are almost 20,000 unanswered questions (mine for example), I understand that many are not "relevant", so I suggest integrating them in one place maybe "Top 100 Stupid (but necessary) question of blender's beginners).It is not my intention to disturb anyone, I simply try to contribute to the community and its smooth operation $\endgroup$ – flobo02 May 31 at 19:55
  • 2
    $\begingroup$ What is the issue here?. Is it instead of searching to find an answer, as you've done, it should be answered ASAP? Please edit this answer to include relevant links and code formatting. $\endgroup$ – batFINGER Jun 1 at 9:29
  • $\begingroup$ Did the formatting and added links to the docs so you have a starting point on how to do that: blender.stackexchange.com/help/how-to-answer $\endgroup$ – brockmann Jun 1 at 15:16
  • $\begingroup$ I still think that the BSE team has lost sight of a very important fact: BLENDER is a wonderful but very complex program. You can see some of your own answers from a few years ago and you will notice what I mean (I hope so). Things as basic as the button tooltips are absurdly hidden even in the manual, I only got to them after reading a lot of questions and answers. Anyway, thanks again for your attention $\endgroup$ – flobo02 Jun 1 at 23:59
  • $\begingroup$ Nope, I don't get your point. Also, there is no "BSE Team", this site is driven by volunteers helping others in their spare time... Indeed Blender is a complex tool -> even more important to ask a clear and precise question in order to get help from others quickly (see my edits, you're welcome btw.). I suggest, take your time, try to understand: blender.stackexchange.com/help/how-to-ask, show some effort and research and you'll most likely get an answer. Also if you have any concerns about this site, I suggest ask a question on meta: blender.meta.stackexchange.com $\endgroup$ – brockmann Jun 2 at 9:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.