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$
3
  • $\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
    Commented May 30, 2020 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
    Commented May 30, 2020 at 13:48
  • $\begingroup$ Related: How to add a custom object entry to the add menu? $\endgroup$
    – brockmann
    Commented Jun 1, 2020 at 15:12

1 Answer 1

1
$\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

$\endgroup$
5
  • 1
    $\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
    Commented May 31, 2020 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
    Commented Jun 1, 2020 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
    Commented Jun 1, 2020 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
    Commented Jun 1, 2020 at 23:59
  • 1
    $\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
    Commented Jun 2, 2020 at 9:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .