Align new objects "to view" not working: GUI menu

The interface, modeling, 3d editing tools, import/export, feature requests, etc

Moderators: jesterKing, stiv

Post Reply
Posts: 2
Joined: Thu Jan 31, 2013 9:51 am
Location: Spain

Align new objects "to view" not working: GUI menu

Post by boblishman » Thu Jan 31, 2013 10:20 am

Is this just a "fault" with the 2.65 build, or is it deliberate?
When I change the user preferences in the EDITING tab to

New Objects:
Align to: VIEW


this DOES NOT make new objects added to a scene align to the 3D window's current view if I use the GUI's MENU/ADD/ method ... and they are still added in WORLD view .... :x

However, if I use the SHIFT+A method to add a new object, that DOES work.

(This is not just limited to meshes, but ALL objects added using the MENU method.)

I do realise that the wording of the tooltip says "from a 3D view menu" and that's why I am asking if this is "by design"

Why is this User Preference Option limited to the SHIFT+A method and not ALSO applied to the MENU method of adding new objects ? ? ?

Can I change this somehow (as I never use SHIFT+A to add stuff) ?


Posts: 1
Joined: Mon Aug 12, 2013 8:55 pm
Location: new jersey

Any response to the above inquiry would still helpful

Post by stellar » Mon Aug 12, 2013 9:00 pm

I too have the same exact question! :?

Posts: 3645
Joined: Tue Aug 05, 2003 7:58 am
Location: 45N 86W

Post by stiv » Tue Aug 13, 2013 12:35 am

1st question: does the problem show up with official 2.68a (latest ver)?

Posts: 15
Joined: Mon Dec 10, 2007 1:52 am
Location: arkansas

It has to do with the way context is passed to the op.

Post by dustractor » Fri Aug 16, 2013 5:47 pm

Spend any amount of time scripting and you will run into this problem.

When operators are run there are various types of execution context such as whether to invoke or execute and from which level of the UI to take the context from. This could be as general as the whole window, or as specific as the particular region where the mouse is at. Windows have screens which have areas which have spaces which have regions which have various types of space data and region data associated.

In other words, it gets complicated.

An operator like the one in question expects to be run in the viewport. expects such and such context. The menu items on the top are actually part of the 'INFO' space, not the 'VIEW_3D' space. When the operator is run from that area -- close but no cigar.

Asks for an area, a region, a space, a screen, a window... gets the wrong one.

Perhaps this could be considered a bug. Not of the operator but the UI. In the INFO_MT_add menu. Here it is, excerpted from

Code: Select all

class INFO_MT_add(Menu):
    bl_label = "Add"

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

        # note, don't use 'EXEC_SCREEN' or operators wont get the 'v3d' context.

        # Note: was EXEC_AREA, but this context does not have the 'rv3d', which prevents
        #       "align_view" to work on first call (see [#32719]).
        layout.operator_context = 'EXEC_REGION_WIN'

        #layout.operator_menu_enum("object.mesh_add", "type", text="Mesh", icon='OUTLINER_OB_MESH')"INFO_MT_mesh_add", icon='OUTLINER_OB_MESH')

        #layout.operator_menu_enum("object.curve_add", "type", text="Curve", icon='OUTLINER_OB_CURVE')"INFO_MT_curve_add", icon='OUTLINER_OB_CURVE')
        #layout.operator_menu_enum("object.surface_add", "type", text="Surface", icon='OUTLINER_OB_SURFACE')"INFO_MT_surface_add", icon='OUTLINER_OB_SURFACE')
        layout.operator_menu_enum("object.metaball_add", "type", text="Metaball", icon='OUTLINER_OB_META')
        layout.operator("object.text_add", text="Text", icon='OUTLINER_OB_FONT')
        layout.separator()"INFO_MT_armature_add", icon='OUTLINER_OB_ARMATURE')
        layout.operator("object.add", text="Lattice", icon='OUTLINER_OB_LATTICE').type = 'LATTICE'
        layout.operator_menu_enum("object.empty_add", "type", text="Empty", icon='OUTLINER_OB_EMPTY')

        layout.operator("object.speaker_add", text="Speaker", icon='OUTLINER_OB_SPEAKER')

        layout.operator("object.camera_add", text="Camera", icon='OUTLINER_OB_CAMERA')
        layout.operator_menu_enum("object.lamp_add", "type", text="Lamp", icon='OUTLINER_OB_LAMP')

        layout.operator_menu_enum("object.effector_add", "type", text="Force Field", icon='OUTLINER_OB_EMPTY')

        if len( > 10:
            layout.operator_context = 'INVOKE_REGION_WIN'
            layout.operator("object.group_instance_add", text="Group Instance...", icon='OUTLINER_OB_EMPTY')
            layout.operator_menu_enum("object.group_instance_add", "group", text="Group Instance", icon='OUTLINER_OB_EMPTY')

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests