[Bf-blender-cvs] [19547236355] master: Cycles: Fix Show Instanced Local View Objects
Jeroen Bakker
noreply at git.blender.org
Thu Sep 12 13:34:20 CEST 2019
Commit: 19547236355d59bc3888635ecbe4a9e35c1f86cb
Author: Jeroen Bakker
Date: Thu Sep 12 11:25:37 2019 +0200
Branches: master
https://developer.blender.org/rB19547236355d59bc3888635ecbe4a9e35c1f86cb
Cycles: Fix Show Instanced Local View Objects
The local view check in the RNA didn't support instanced objects. Every
object has a copy of the local_view_bits from the base. This patch
changes the check to look at the local stored bits.
This patch removes the check if the object is part of the view_layer.
In the cases we are using it this check is not relevant. The `mesh_tissue`
add-on also uses it, and is not effected by this change.
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D5773
===================================================================
M intern/cycles/blender/blender_object.cpp
M source/blender/makesrna/intern/rna_object_api.c
===================================================================
diff --git a/intern/cycles/blender/blender_object.cpp b/intern/cycles/blender/blender_object.cpp
index 082fff0c528..59509d20fb2 100644
--- a/intern/cycles/blender/blender_object.cpp
+++ b/intern/cycles/blender/blender_object.cpp
@@ -555,7 +555,7 @@ void BlenderSync::sync_objects(BL::Depsgraph &b_depsgraph,
/* test if object needs to be hidden */
const bool show_self = b_instance.show_self();
- const bool show_local_view = !has_local_view || b_ob.local_view_get(b_v3d, b_view_layer);
+ const bool show_local_view = !has_local_view || b_ob.local_view_get(b_v3d);
const bool show_particles = b_instance.show_particles();
if (show_local_view && (show_self || show_particles)) {
diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c
index e26c430eb16..56d25f5bebf 100644
--- a/source/blender/makesrna/intern/rna_object_api.c
+++ b/source/blender/makesrna/intern/rna_object_api.c
@@ -250,18 +250,14 @@ static Base *rna_Object_local_view_property_helper(bScreen *sc,
return base;
}
-static bool rna_Object_local_view_get(Object *ob,
- ReportList *reports,
- PointerRNA *v3d_ptr,
- ViewLayer *view_layer)
+static bool rna_Object_local_view_get(Object *ob, ReportList *reports, View3D *v3d)
{
- bScreen *sc = (bScreen *)v3d_ptr->owner_id;
- View3D *v3d = v3d_ptr->data;
- Base *base = rna_Object_local_view_property_helper(sc, v3d, view_layer, ob, reports, NULL);
- if (base == NULL) {
- return false; /* Error reported. */
+ if (v3d->localvd == NULL) {
+ BKE_report(reports, RPT_ERROR, "Viewport not in local view");
+ return false;
}
- return (base->local_view_bits & v3d->local_view_uuid) != 0;
+
+ return ((ob->base_local_view_bits & v3d->local_view_uuid) != 0);
}
static void rna_Object_local_view_set(Object *ob,
@@ -817,12 +813,7 @@ void RNA_api_object(StructRNA *srna)
RNA_def_function_ui_description(func, "Get the local view state for this object");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
parm = RNA_def_pointer(func, "viewport", "SpaceView3D", "", "Viewport in local view");
- RNA_def_parameter_flags(parm, 0, PARM_RNAPTR | PARM_REQUIRED);
- parm = RNA_def_pointer(func,
- "view_layer",
- "ViewLayer",
- "",
- "Optional ViewLayer. Preferably passed for additional performance");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
parm = RNA_def_boolean(func, "result", 0, "", "Object local view state");
RNA_def_function_return(func, parm);
More information about the Bf-blender-cvs
mailing list