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$
  • $\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 Jun 3 '14 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 Jun 4 '14 at 19:24
2
$\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.

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)

|improve this answer|||||
$\endgroup$

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.