LibOverride: deprecate Proxies: Remove 'Make Proxy' operator.
This commit is contained in:
@@ -1944,7 +1944,6 @@ url_manual_mapping = (
|
|||||||
("bpy.ops.object.origin_set*", "scene_layout/object/origin.html#bpy-ops-object-origin-set"),
|
("bpy.ops.object.origin_set*", "scene_layout/object/origin.html#bpy-ops-object-origin-set"),
|
||||||
("bpy.ops.object.parent_set*", "scene_layout/object/editing/parent.html#bpy-ops-object-parent-set"),
|
("bpy.ops.object.parent_set*", "scene_layout/object/editing/parent.html#bpy-ops-object-parent-set"),
|
||||||
("bpy.ops.object.pointcloud*", "modeling/point_cloud.html#bpy-ops-object-pointcloud"),
|
("bpy.ops.object.pointcloud*", "modeling/point_cloud.html#bpy-ops-object-pointcloud"),
|
||||||
("bpy.ops.object.proxy_make*", "files/linked_libraries/library_proxies.html#bpy-ops-object-proxy-make"),
|
|
||||||
("bpy.ops.object.select_all*", "scene_layout/object/selecting.html#bpy-ops-object-select-all"),
|
("bpy.ops.object.select_all*", "scene_layout/object/selecting.html#bpy-ops-object-select-all"),
|
||||||
("bpy.ops.object.shade_flat*", "scene_layout/object/editing/shading.html#bpy-ops-object-shade-flat"),
|
("bpy.ops.object.shade_flat*", "scene_layout/object/editing/shading.html#bpy-ops-object-shade-flat"),
|
||||||
("bpy.ops.pose.group_assign*", "animation/armatures/properties/bone_groups.html#bpy-ops-pose-group-assign"),
|
("bpy.ops.pose.group_assign*", "animation/armatures/properties/bone_groups.html#bpy-ops-pose-group-assign"),
|
||||||
|
|||||||
@@ -4396,7 +4396,6 @@ def km_object_mode(params):
|
|||||||
("object.duplicates_make_real", {"type": 'A', "value": 'PRESS', "shift": True, "ctrl": True}, None),
|
("object.duplicates_make_real", {"type": 'A', "value": 'PRESS', "shift": True, "ctrl": True}, None),
|
||||||
op_menu("VIEW3D_MT_make_single_user", {"type": 'U', "value": 'PRESS'}),
|
op_menu("VIEW3D_MT_make_single_user", {"type": 'U', "value": 'PRESS'}),
|
||||||
("object.convert", {"type": 'C', "value": 'PRESS', "alt": True}, None),
|
("object.convert", {"type": 'C', "value": 'PRESS', "alt": True}, None),
|
||||||
("object.proxy_make", {"type": 'P', "value": 'PRESS', "ctrl": True, "alt": True}, None),
|
|
||||||
("object.make_local", {"type": 'L', "value": 'PRESS'}, None),
|
("object.make_local", {"type": 'L', "value": 'PRESS'}, None),
|
||||||
("object.data_transfer", {"type": 'T', "value": 'PRESS', "shift": True, "ctrl": True}, None),
|
("object.data_transfer", {"type": 'T', "value": 'PRESS', "shift": True, "ctrl": True}, None),
|
||||||
])
|
])
|
||||||
|
|||||||
@@ -2234,8 +2234,6 @@ class VIEW3D_MT_object_relations(Menu):
|
|||||||
def draw(self, _context):
|
def draw(self, _context):
|
||||||
layout = self.layout
|
layout = self.layout
|
||||||
|
|
||||||
layout.operator("object.proxy_make", text="Make Proxy...")
|
|
||||||
|
|
||||||
layout.operator("object.make_override_library", text="Make Library Override...")
|
layout.operator("object.make_override_library", text="Make Library Override...")
|
||||||
|
|
||||||
layout.operator("object.convert_proxy_to_override")
|
layout.operator("object.convert_proxy_to_override")
|
||||||
|
|||||||
@@ -78,7 +78,6 @@ void OBJECT_OT_mode_set(struct wmOperatorType *ot);
|
|||||||
void OBJECT_OT_mode_set_with_submode(struct wmOperatorType *ot);
|
void OBJECT_OT_mode_set_with_submode(struct wmOperatorType *ot);
|
||||||
void OBJECT_OT_editmode_toggle(struct wmOperatorType *ot);
|
void OBJECT_OT_editmode_toggle(struct wmOperatorType *ot);
|
||||||
void OBJECT_OT_posemode_toggle(struct wmOperatorType *ot);
|
void OBJECT_OT_posemode_toggle(struct wmOperatorType *ot);
|
||||||
void OBJECT_OT_proxy_make(struct wmOperatorType *ot);
|
|
||||||
void OBJECT_OT_shade_smooth(struct wmOperatorType *ot);
|
void OBJECT_OT_shade_smooth(struct wmOperatorType *ot);
|
||||||
void OBJECT_OT_shade_flat(struct wmOperatorType *ot);
|
void OBJECT_OT_shade_flat(struct wmOperatorType *ot);
|
||||||
void OBJECT_OT_paths_calculate(struct wmOperatorType *ot);
|
void OBJECT_OT_paths_calculate(struct wmOperatorType *ot);
|
||||||
|
|||||||
@@ -56,7 +56,6 @@ void ED_operatortypes_object(void)
|
|||||||
WM_operatortype_append(OBJECT_OT_mode_set_with_submode);
|
WM_operatortype_append(OBJECT_OT_mode_set_with_submode);
|
||||||
WM_operatortype_append(OBJECT_OT_editmode_toggle);
|
WM_operatortype_append(OBJECT_OT_editmode_toggle);
|
||||||
WM_operatortype_append(OBJECT_OT_posemode_toggle);
|
WM_operatortype_append(OBJECT_OT_posemode_toggle);
|
||||||
WM_operatortype_append(OBJECT_OT_proxy_make);
|
|
||||||
WM_operatortype_append(OBJECT_OT_shade_smooth);
|
WM_operatortype_append(OBJECT_OT_shade_smooth);
|
||||||
WM_operatortype_append(OBJECT_OT_shade_flat);
|
WM_operatortype_append(OBJECT_OT_shade_flat);
|
||||||
WM_operatortype_append(OBJECT_OT_paths_calculate);
|
WM_operatortype_append(OBJECT_OT_paths_calculate);
|
||||||
|
|||||||
@@ -330,167 +330,6 @@ void OBJECT_OT_vertex_parent_set(wmOperatorType *ot)
|
|||||||
|
|
||||||
/** \} */
|
/** \} */
|
||||||
|
|
||||||
/* ------------------------------------------------------------------- */
|
|
||||||
/** \name Make Proxy Operator
|
|
||||||
* \{ */
|
|
||||||
|
|
||||||
/* set the object to proxify */
|
|
||||||
static int make_proxy_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
|
||||||
{
|
|
||||||
Scene *scene = CTX_data_scene(C);
|
|
||||||
Object *ob = ED_object_active_context(C);
|
|
||||||
|
|
||||||
/* sanity checks */
|
|
||||||
if (!scene || ID_IS_LINKED(scene) || !ob) {
|
|
||||||
return OPERATOR_CANCELLED;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Get object to work on - use a menu if we need to... */
|
|
||||||
if (ob->instance_collection && ID_IS_LINKED(ob->instance_collection)) {
|
|
||||||
/* gives menu with list of objects in group */
|
|
||||||
/* proxy_group_objects_menu(C, op, ob, ob->instance_collection); */
|
|
||||||
WM_enum_search_invoke(C, op, event);
|
|
||||||
return OPERATOR_CANCELLED;
|
|
||||||
}
|
|
||||||
if (ID_IS_LINKED(ob)) {
|
|
||||||
uiPopupMenu *pup = UI_popup_menu_begin(C, IFACE_("OK?"), ICON_QUESTION);
|
|
||||||
uiLayout *layout = UI_popup_menu_layout(pup);
|
|
||||||
|
|
||||||
/* create operator menu item with relevant properties filled in */
|
|
||||||
PointerRNA opptr_dummy;
|
|
||||||
uiItemFullO_ptr(
|
|
||||||
layout, op->type, op->type->name, ICON_NONE, NULL, WM_OP_EXEC_REGION_WIN, 0, &opptr_dummy);
|
|
||||||
|
|
||||||
/* present the menu and be done... */
|
|
||||||
UI_popup_menu_end(C, pup);
|
|
||||||
|
|
||||||
/* this invoke just calls another instance of this operator... */
|
|
||||||
return OPERATOR_INTERFACE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* error.. cannot continue */
|
|
||||||
BKE_report(op->reports, RPT_ERROR, "Can only make proxy for a referenced object or collection");
|
|
||||||
return OPERATOR_CANCELLED;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int make_proxy_exec(bContext *C, wmOperator *op)
|
|
||||||
{
|
|
||||||
Main *bmain = CTX_data_main(C);
|
|
||||||
Object *ob, *gob = ED_object_active_context(C);
|
|
||||||
Scene *scene = CTX_data_scene(C);
|
|
||||||
ViewLayer *view_layer = CTX_data_view_layer(C);
|
|
||||||
|
|
||||||
if (gob->instance_collection != NULL) {
|
|
||||||
const ListBase instance_collection_objects = BKE_collection_object_cache_get(
|
|
||||||
gob->instance_collection);
|
|
||||||
Base *base = BLI_findlink(&instance_collection_objects, RNA_enum_get(op->ptr, "object"));
|
|
||||||
ob = base->object;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ob = gob;
|
|
||||||
gob = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ob) {
|
|
||||||
Object *newob;
|
|
||||||
char name[MAX_ID_NAME + 4];
|
|
||||||
|
|
||||||
BLI_snprintf(name, sizeof(name), "%s_proxy", ((ID *)(gob ? gob : ob))->name + 2);
|
|
||||||
|
|
||||||
/* Add new object for the proxy */
|
|
||||||
newob = BKE_object_add_from(bmain, scene, view_layer, OB_EMPTY, name, gob ? gob : ob);
|
|
||||||
|
|
||||||
/* set layers OK */
|
|
||||||
BKE_object_make_proxy(bmain, newob, ob, gob);
|
|
||||||
|
|
||||||
/* Set back pointer immediately so dependency graph knows that this is
|
|
||||||
* is a proxy and will act accordingly. Otherwise correctness of graph
|
|
||||||
* will depend on order of bases.
|
|
||||||
*
|
|
||||||
* TODO(sergey): We really need to get rid of this bi-directional links
|
|
||||||
* in proxies with something like library overrides.
|
|
||||||
*/
|
|
||||||
if (newob->proxy != NULL) {
|
|
||||||
newob->proxy->proxy_from = newob;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
BKE_report(op->reports, RPT_ERROR, "Unable to assign proxy");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* depsgraph flushes are needed for the new data */
|
|
||||||
DEG_relations_tag_update(bmain);
|
|
||||||
DEG_id_tag_update(&newob->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_ANIMATION);
|
|
||||||
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, newob);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
BKE_report(op->reports, RPT_ERROR, "No object to make proxy for");
|
|
||||||
return OPERATOR_CANCELLED;
|
|
||||||
}
|
|
||||||
|
|
||||||
return OPERATOR_FINISHED;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Generic itemf's for operators that take library args */
|
|
||||||
static const EnumPropertyItem *proxy_collection_object_itemf(bContext *C,
|
|
||||||
PointerRNA *UNUSED(ptr),
|
|
||||||
PropertyRNA *UNUSED(prop),
|
|
||||||
bool *r_free)
|
|
||||||
{
|
|
||||||
EnumPropertyItem item_tmp = {0}, *item = NULL;
|
|
||||||
int totitem = 0;
|
|
||||||
int i = 0;
|
|
||||||
Object *ob = ED_object_active_context(C);
|
|
||||||
|
|
||||||
if (!ob || !ob->instance_collection) {
|
|
||||||
return DummyRNA_DEFAULT_items;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* find the object to affect */
|
|
||||||
FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN (ob->instance_collection, object) {
|
|
||||||
item_tmp.identifier = item_tmp.name = object->id.name + 2;
|
|
||||||
item_tmp.value = i++;
|
|
||||||
RNA_enum_item_add(&item, &totitem, &item_tmp);
|
|
||||||
}
|
|
||||||
FOREACH_COLLECTION_OBJECT_RECURSIVE_END;
|
|
||||||
|
|
||||||
RNA_enum_item_end(&item, &totitem);
|
|
||||||
*r_free = true;
|
|
||||||
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
|
|
||||||
void OBJECT_OT_proxy_make(wmOperatorType *ot)
|
|
||||||
{
|
|
||||||
PropertyRNA *prop;
|
|
||||||
|
|
||||||
/* identifiers */
|
|
||||||
ot->name = "Make Proxy";
|
|
||||||
ot->idname = "OBJECT_OT_proxy_make";
|
|
||||||
ot->description = "Add empty object to become local replacement data of a library-linked object";
|
|
||||||
|
|
||||||
/* callbacks */
|
|
||||||
ot->invoke = make_proxy_invoke;
|
|
||||||
ot->exec = make_proxy_exec;
|
|
||||||
ot->poll = ED_operator_object_active;
|
|
||||||
|
|
||||||
/* flags */
|
|
||||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
|
||||||
|
|
||||||
/* properties */
|
|
||||||
/* XXX, relies on hard coded ID at the moment */
|
|
||||||
prop = RNA_def_enum(ot->srna,
|
|
||||||
"object",
|
|
||||||
DummyRNA_DEFAULT_items,
|
|
||||||
0,
|
|
||||||
"Proxy Object",
|
|
||||||
"Name of library-linked/collection object to make a proxy for");
|
|
||||||
RNA_def_enum_funcs(prop, proxy_collection_object_itemf);
|
|
||||||
RNA_def_property_flag(prop, PROP_ENUM_NO_TRANSLATE);
|
|
||||||
ot->prop = prop;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** \} */
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------- */
|
||||||
/** \name Clear Parent Operator
|
/** \name Clear Parent Operator
|
||||||
* \{ */
|
* \{ */
|
||||||
|
|||||||
Reference in New Issue
Block a user