Page MenuHome

Add Object name to Add Object adjustment panel
Open, NormalPublic

Description

When adding objects, it can be advantageous to set the object name immediately.

We can support this by adding the object name to the Add Object adjustment panel:

Suggestion by HooglyBoogly on Devtalk.

Details

Type
To Do

Event Timeline

While I don't have a strong opinion on this, think overall it's not an improvement but would be interested to know if artists in the studio think this is helpful.


Would rather not have this, there are many properties related to object creation we could allow to edit here.

Editing a name shouldn't be difficult, showing less information up-front and making sure it simple for users to edit things is better.

I thought it would be worth it because I end up naming most of the primitives I add in many workflows anyway, so it saves a step of finding it in the outliner or properties.

I'm not sure adding an object name section in the n panel is better than this, and it seems like the alternative. That way you're cluttering the UI that the user always sees rather than presenting one more option when it's most useful.

There could be ways of integrating / hiding it more in the UI that would increase the difficulty of implementation but not have the drawback of another option in the menu. I agree it would be nice to have more opinions.

I've been pursuing this for a bit. I thought I would provide an update in case it was helpful to anyone:

As far as I can tell, OBJECT_OT_add is only used for lattices. The other object additions have there own callback functions. So each callback will have to be changed separately. The mesh primitive add functions are in editmesh_add.c.

I added a new function that adds the name property in object_add.c:

void ED_object_add_object_name(wmOperatorType *ot, const char *default_name)
{
    PropertyRNA *prop;
    prop = RNA_def_string(ot->srna, "input_name", default_name, 64, "Name", "The name of the new object");
    RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}

I used this in all of the primitive add functions. The problem is that the same operators are used in edit mode and object mode, so the name field is added in edit mode as well. So I need to check if edit mode is active before adding the property. This looks like the best way to do that:

Object *obedit = CTX_data_edit_object(C);
   
if (obedit == NULL) {...}

However, there is no reference to the blender context in the primitive add functions (MESH_OT_primitive_*_add); the reference is only in the exec functions. Unless there is another way to access whether edit mode is active or not, implementing this change might be more complicated.