1
$\begingroup$

I want to change some menues in the 3D View, for example the Specials Menu. So I added some lines. If i have an error in my changes, Blender reports this in the system console. But when I press W, my changes don't appear. Here is my changed Script:

(C:\Program Files\Blender Foundation\Blender\2.70\scripts\startup\bl_ui\space_view3d.py)

   ...  (line 1116)
class VIEW3D_MT_object_specials(Menu):
    bl_label = "Specials"
    @classmethod
    def poll(cls, context):
        # add more special types
        return context.object

    def draw(self, context):
        layout = self.layout

        scene = context.scene
        obj = context.object

        if obj.type == 'MESH':
           mesh = obj.data
           layout.operator_context = 'INVOKE_REGION_WIN'
           layout.operator("object.shade_smooth", text="Shade Smooth")
           layout.operator("object.shade_flat", text="Shade Flat")
           if scene.render.use_shading_nodes:
               try:
                   props = layout.prop(mesh.materials[0].node_tree.nodes["Emission"].inputs["Strength"],"default_value", text="Emission Strength")
               except:
                   pass
   ...

Also if I run Blender with Admin Rights on my Win7 Computer the Changes dont appear.
What is wrong?

$\endgroup$
2
  • $\begingroup$ Did you actually save changes to the file? (requires administrator rights). You also need to restart Blender if you change anything in startup and modules. $\endgroup$
    – CodeManX
    Commented Jun 3, 2014 at 22:39
  • $\begingroup$ Found my error! I copied my bl_ui Folder (to keep the original scripts) into the same directory as bl_ui-Copy. I thinked Blender will ignore this folder because of the changed name, but by pressing F8 I see it run all Folders in that directory. Thanks! $\endgroup$
    – Leon95
    Commented Jun 4, 2014 at 19:24

2 Answers 2

3
$\begingroup$

One option is to run the altered script while it is in blender's text editor. There is a button in the text editor header for this.

Another option is to save the changes to disk and press F8. This will have blender re-run all the interface and addon scripts similar to having re-started blender, which is also an option.
Edit: Since 2.80, F8 isn't assigned anymore, you need to use the menu Blender icon ► System ► Reload Scripts:
enter image description here

Having said that, it isn't recommended to alter the scripts that come with blender. You can create an addon that alters or adds to existing menus and lets you easily turn it on/off as well as use it again in the next version after you update.

If you look at some existing addons you can easily work out that you can add to the object specials menu with a line such as bpy.types.VIEW3D_MT_object_specials.append(MyMenu)

$\endgroup$
0
$\begingroup$

On windows I use visual studio code and open this folder:

%AppData%\Blender Foundation\Blender\2.90\scripts\addons

(this is the actual files blender is running so it you make a typo and save. blender will complain. double edged sword. so warning)

I then assign f8 to be reload scripts

(I have "Auto-Save on window change" VS code extension active so it saves when I alt-tab away)

enter image description here

workflow looks like this:

  1. code
  2. alt-tab to blender
  3. f8 to reload all scripts
  4. test my script changes
$\endgroup$

You must log in to answer this question.

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