Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/object')
-rw-r--r--source/blender/editors/object/object_bake_api.c24
-rw-r--r--source/blender/editors/object/object_data_transfer.c20
-rw-r--r--source/blender/editors/object/object_group.c11
-rw-r--r--source/blender/editors/object/object_ops.c24
-rw-r--r--source/blender/editors/object/object_relations.c19
5 files changed, 59 insertions, 39 deletions
diff --git a/source/blender/editors/object/object_bake_api.c b/source/blender/editors/object/object_bake_api.c
index b456342f8f0..1d93d664a5a 100644
--- a/source/blender/editors/object/object_bake_api.c
+++ b/source/blender/editors/object/object_bake_api.c
@@ -49,6 +49,7 @@
#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_image.h"
+#include "BKE_layer.h"
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_material.h"
@@ -360,17 +361,24 @@ static bool is_noncolor_pass(eScenePassType pass_type)
}
/* if all is good tag image and return true */
-static bool bake_object_check(Scene *scene, Object *ob, ReportList *reports)
+static bool bake_object_check(ViewLayer *view_layer, Object *ob, ReportList *reports)
{
Image *image;
+ Base *base = BKE_view_layer_base_find(view_layer, ob);
void *lock;
int i;
- if ((ob->lay & scene->lay) == 0) {
- BKE_reportf(reports, RPT_ERROR, "Object \"%s\" is not on a scene layer", ob->id.name + 2);
+ if (base == NULL) {
+ BKE_reportf(reports, RPT_ERROR, "Object \"%s\" is not in view layer", ob->id.name + 2);
return false;
}
+ if (!(base->flag & BASE_ENABLED_RENDER)) {
+ BKE_reportf(reports, RPT_ERROR, "Object \"%s\" is not enabled for rendering", ob->id.name + 2);
+ return false;
+ }
+
+
if (ob->type != OB_MESH) {
BKE_reportf(reports, RPT_ERROR, "Object \"%s\" is not a mesh", ob->id.name + 2);
return false;
@@ -500,7 +508,7 @@ static bool bake_pass_filter_check(eScenePassType pass_type, const int pass_filt
}
/* before even getting in the bake function we check for some basic errors */
-static bool bake_objects_check(Main *bmain, Scene *scene, Object *ob, ListBase *selected_objects,
+static bool bake_objects_check(Main *bmain, ViewLayer *view_layer, Object *ob, ListBase *selected_objects,
ReportList *reports, const bool is_selected_to_active)
{
CollectionPointerLink *link;
@@ -511,7 +519,7 @@ static bool bake_objects_check(Main *bmain, Scene *scene, Object *ob, ListBase *
if (is_selected_to_active) {
int tot_objects = 0;
- if (!bake_object_check(scene, ob, reports))
+ if (!bake_object_check(view_layer, ob, reports))
return false;
for (link = selected_objects->first; link; link = link->next) {
@@ -539,7 +547,7 @@ static bool bake_objects_check(Main *bmain, Scene *scene, Object *ob, ListBase *
}
for (link = selected_objects->first; link; link = link->next) {
- if (!bake_object_check(scene, link->ptr.data, reports))
+ if (!bake_object_check(view_layer, link->ptr.data, reports))
return false;
}
}
@@ -1207,7 +1215,7 @@ static int bake_exec(bContext *C, wmOperator *op)
goto finally;
}
- if (!bake_objects_check(bkr.main, bkr.scene, bkr.ob, &bkr.selected_objects, bkr.reports, bkr.is_selected_to_active)) {
+ if (!bake_objects_check(bkr.main, bkr.view_layer, bkr.ob, &bkr.selected_objects, bkr.reports, bkr.is_selected_to_active)) {
goto finally;
}
@@ -1266,7 +1274,7 @@ static void bake_startjob(void *bkv, short *UNUSED(stop), short *do_update, floa
return;
}
- if (!bake_objects_check(bkr->main, bkr->scene, bkr->ob, &bkr->selected_objects, bkr->reports, bkr->is_selected_to_active)) {
+ if (!bake_objects_check(bkr->main, bkr->view_layer, bkr->ob, &bkr->selected_objects, bkr->reports, bkr->is_selected_to_active)) {
bkr->result = OPERATOR_CANCELLED;
return;
}
diff --git a/source/blender/editors/object/object_data_transfer.c b/source/blender/editors/object/object_data_transfer.c
index f56fd560946..ad0b091ede9 100644
--- a/source/blender/editors/object/object_data_transfer.c
+++ b/source/blender/editors/object/object_data_transfer.c
@@ -450,8 +450,9 @@ static bool data_transfer_poll(bContext *C)
}
/* Used by both OBJECT_OT_data_transfer and OBJECT_OT_datalayout_transfer */
-static bool data_transfer_draw_check_prop(PointerRNA *ptr, PropertyRNA *prop)
+static bool data_transfer_poll_property(const bContext *UNUSED(C), wmOperator *op, const PropertyRNA *prop)
{
+ PointerRNA *ptr = op->ptr;
PropertyRNA *prop_other;
const char *prop_id = RNA_property_identifier(prop);
@@ -512,19 +513,6 @@ static bool data_transfer_draw_check_prop(PointerRNA *ptr, PropertyRNA *prop)
return true;
}
-/* Used by both OBJECT_OT_data_transfer and OBJECT_OT_datalayout_transfer */
-static void data_transfer_ui(bContext *C, wmOperator *op)
-{
- uiLayout *layout = op->layout;
- wmWindowManager *wm = CTX_wm_manager(C);
- PointerRNA ptr;
-
- RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr);
-
- /* Main auto-draw call */
- uiDefAutoButsRNA(layout, &ptr, data_transfer_draw_check_prop, UI_BUT_LABEL_ALIGN_NONE, false);
-}
-
/* transfers weight from active to selected */
void OBJECT_OT_data_transfer(wmOperatorType *ot)
{
@@ -537,10 +525,10 @@ void OBJECT_OT_data_transfer(wmOperatorType *ot)
/* API callbacks.*/
ot->poll = data_transfer_poll;
+ ot->poll_property = data_transfer_poll_property;
ot->invoke = WM_menu_invoke;
ot->exec = data_transfer_exec;
ot->check = data_transfer_check;
- ot->ui = data_transfer_ui;
/* Flags.*/
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -700,10 +688,10 @@ void OBJECT_OT_datalayout_transfer(wmOperatorType *ot)
ot->idname = "OBJECT_OT_datalayout_transfer";
ot->poll = datalayout_transfer_poll;
+ ot->poll_property = data_transfer_poll_property;
ot->invoke = datalayout_transfer_invoke;
ot->exec = datalayout_transfer_exec;
ot->check = data_transfer_check;
- ot->ui = data_transfer_ui;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
diff --git a/source/blender/editors/object/object_group.c b/source/blender/editors/object/object_group.c
index 53cabe3759e..72c5fde2955 100644
--- a/source/blender/editors/object/object_group.c
+++ b/source/blender/editors/object/object_group.c
@@ -411,6 +411,9 @@ static int collection_add_exec(bContext *C, wmOperator *UNUSED(op))
id_fake_user_set(&collection->id);
BKE_collection_object_add(bmain, collection, ob);
+ DEG_id_tag_update(&collection->id, DEG_TAG_COPY_ON_WRITE);
+ DEG_relations_tag_update(bmain);
+
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
return OPERATOR_FINISHED;
@@ -460,6 +463,9 @@ static int collection_link_exec(bContext *C, wmOperator *op)
BKE_collection_object_add(bmain, collection, ob);
+ DEG_id_tag_update(&collection->id, DEG_TAG_COPY_ON_WRITE);
+ DEG_relations_tag_update(bmain);
+
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
return OPERATOR_FINISHED;
@@ -500,6 +506,9 @@ static int collection_remove_exec(bContext *C, wmOperator *UNUSED(op))
BKE_collection_object_remove(bmain, collection, ob, false);
+ DEG_id_tag_update(&collection->id, DEG_TAG_COPY_ON_WRITE);
+ DEG_relations_tag_update(bmain);
+
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
return OPERATOR_FINISHED;
@@ -531,6 +540,8 @@ static int collection_unlink_exec(bContext *C, wmOperator *UNUSED(op))
BKE_libblock_delete(bmain, collection);
+ DEG_relations_tag_update(bmain);
+
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, NULL);
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c
index 5a83d085aee..7b6c1156874 100644
--- a/source/blender/editors/object/object_ops.c
+++ b/source/blender/editors/object/object_ops.c
@@ -40,6 +40,7 @@
#include "BKE_context.h"
#include "RNA_access.h"
+#include "RNA_enum_types.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -490,3 +491,26 @@ void ED_keymap_proportional_editmode(struct wmKeyConfig *UNUSED(keyconf), struct
RNA_string_set(kmi->ptr, "value_2", "CONNECTED");
}
}
+
+/**
+ * Map 1..3 to Vert/Edge/Face.
+ */
+void ED_keymap_editmesh_elem_mode(struct wmKeyConfig *UNUSED(keyconf), struct wmKeyMap *keymap)
+{
+ for (int i = 0; i < 4; i++) {
+ const bool is_extend = (i & 1);
+ const bool is_expand = (i & 2);
+ const int key_modifier = (is_extend ? KM_SHIFT : 0) | (is_expand ? KM_CTRL : 0);
+ for (int j = 0; j < 3; j++) {
+ wmKeyMapItem *kmi = WM_keymap_add_item(
+ keymap, "MESH_OT_select_mode", ONEKEY + j, KM_PRESS, key_modifier, 0);
+ RNA_enum_set(kmi->ptr, "type", SCE_SELECT_VERTEX << j);
+ if (is_extend) {
+ RNA_boolean_set(kmi->ptr, "use_extend", true);
+ }
+ if (is_expand) {
+ RNA_boolean_set(kmi->ptr, "use_expand", true);
+ }
+ }
+ }
+}
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index 2c3ff8b6afe..4745a484475 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -947,13 +947,13 @@ static int parent_set_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent
return OPERATOR_INTERFACE;
}
-static bool parent_set_draw_check_prop(PointerRNA *ptr, PropertyRNA *prop)
+static bool parent_set_poll_property(const bContext *UNUSED(C), wmOperator *op, const PropertyRNA *prop)
{
const char *prop_id = RNA_property_identifier(prop);
- const int type = RNA_enum_get(ptr, "type");
/* Only show XMirror for PAR_ARMATURE_ENVELOPE and PAR_ARMATURE_AUTO! */
if (STREQ(prop_id, "xmirror")) {
+ const int type = RNA_enum_get(op->ptr, "type");
if (ELEM(type, PAR_ARMATURE_ENVELOPE, PAR_ARMATURE_AUTO))
return true;
else
@@ -963,18 +963,6 @@ static bool parent_set_draw_check_prop(PointerRNA *ptr, PropertyRNA *prop)
return true;
}
-static void parent_set_ui(bContext *C, wmOperator *op)
-{
- uiLayout *layout = op->layout;
- wmWindowManager *wm = CTX_wm_manager(C);
- PointerRNA ptr;
-
- RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr);
-
- /* Main auto-draw call. */
- uiDefAutoButsRNA(layout, &ptr, parent_set_draw_check_prop, UI_BUT_LABEL_ALIGN_NONE, false);
-}
-
void OBJECT_OT_parent_set(wmOperatorType *ot)
{
/* identifiers */
@@ -986,7 +974,7 @@ void OBJECT_OT_parent_set(wmOperatorType *ot)
ot->invoke = parent_set_invoke;
ot->exec = parent_set_exec;
ot->poll = ED_operator_object_active;
- ot->ui = parent_set_ui;
+ ot->poll_property = parent_set_poll_property;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -2329,6 +2317,7 @@ static int make_override_static_exec(bContext *C, wmOperator *op)
if (new_ob != NULL && new_ob->id.override_static != NULL) {
if ((base = BKE_view_layer_base_find(view_layer, new_ob)) == NULL) {
BKE_collection_object_add_from(bmain, scene, obcollection, new_ob);
+ base = BKE_view_layer_base_find(view_layer, new_ob);
DEG_id_tag_update_ex(bmain, &new_ob->id, DEG_TAG_TRANSFORM | DEG_TAG_BASE_FLAGS_UPDATE);
}
/* parent to 'collection' empty */