Commit: 1243299bee0be7225c673aaad55f93f4ab1d5d40 Author: YimingWu Date: Tue Jun 18 18:28:36 2019 +0800 Branches: soc-2019-npr https://developer.blender.org/rB1243299bee0be7225c673aaad55f93f4ab1d5d40
LANPR: Added collection properties. =================================================================== M release/scripts/startup/bl_ui/properties_view_layer.py M source/blender/makesdna/DNA_collection_types.h M source/blender/makesrna/intern/rna_collection.c =================================================================== diff --git a/release/scripts/startup/bl_ui/properties_view_layer.py b/release/scripts/startup/bl_ui/properties_view_layer.py index 121b8f2f401..2ebe55c65d5 100644 --- a/release/scripts/startup/bl_ui/properties_view_layer.py +++ b/release/scripts/startup/bl_ui/properties_view_layer.py @@ -82,10 +82,25 @@ class VIEWLAYER_PT_eevee_layer_passes(ViewLayerButtonsPanel, Panel): col = flow.column() col.prop(view_layer, "use_pass_subsurface_color", text="Subsurface Color") +class VIEWLAYER_PT_lanpr_collection(ViewLayerButtonsPanel, Panel): + bl_label = "Collection LANPR" + + @classmethod + def poll(cls, context): + return context.scene.lanpr.enabled + + def draw(self,context): + layout = self.layout + collection = context.collection + row = layout.row() + row.prop(collection.lanpr,"usage",expand=True) + if collection.lanpr.usage!='INCLUDE': + layout.prop(collection.lanpr,"force") classes = ( VIEWLAYER_PT_layer, VIEWLAYER_PT_eevee_layer_passes, + VIEWLAYER_PT_lanpr_collection, ) if __name__ == "__main__": # only for live edit. diff --git a/source/blender/makesdna/DNA_collection_types.h b/source/blender/makesdna/DNA_collection_types.h index c7f3ef4156d..9b72217a37a 100644 --- a/source/blender/makesdna/DNA_collection_types.h +++ b/source/blender/makesdna/DNA_collection_types.h @@ -43,6 +43,19 @@ typedef struct CollectionChild { struct Collection *collection; } CollectionChild; +typedef struct CollectionLANPR{ + short usage; + short force;/* force objects with LANPR modifier follow the rule */ + char _pad[4]; +}CollectionLANPR; + +/* CollectionLANPR->mode */ +enum { + COLLECTION_LANPR_INCLUDE = 0, + COLLECTION_LANPR_OCCLUSION_ONLY = 1, + COLLECTION_LANPR_EXCLUDE = 2, +}; + typedef struct Collection { ID id; @@ -59,6 +72,9 @@ typedef struct Collection { short flag; char _pad[6]; + /** LANPR engine specific */ + CollectionLANPR lanpr; + /* Runtime. Cache of objects in this collection and all its * children. This is created on demand when e.g. some physics * simulation needs it, we don't want to have it for every diff --git a/source/blender/makesrna/intern/rna_collection.c b/source/blender/makesrna/intern/rna_collection.c index 5a37c4c0e6f..7bd55f58a64 100644 --- a/source/blender/makesrna/intern/rna_collection.c +++ b/source/blender/makesrna/intern/rna_collection.c @@ -365,6 +365,32 @@ static void rna_def_collection_children(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); } +static void rna_def_collection_lanpr(BlenderRNA *brna,StructRNA *srna) +{ + PropertyRNA *prop; + + static const EnumPropertyItem rna_collection_lanpr_usage[] = { + {0, "INCLUDE", 0, "Include", "Include the collection into LANPR calculation"}, + {1, "OCCLUSION_ONLY", 0, "Occlusion Only", "Only use the collction to produce occlusion"}, + {2, "EXCLUDE", 0, "Exclude", "Don't use this collection in LANPR"}, + {0, NULL, 0, NULL, NULL}}; + + srna = RNA_def_struct(brna, "CollectionLANPR", NULL); + RNA_def_struct_sdna(srna, "CollectionLANPR"); + RNA_def_struct_ui_text(srna, "Collection LANPR Usage", "LANPR usage for this collection"); + + prop = RNA_def_property(srna, "usage", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, rna_collection_lanpr_usage); + RNA_def_property_enum_default(prop, 0); + RNA_def_property_ui_text(prop, "Usage", "How to use this collection in LANPR"); + RNA_def_property_update(prop, NC_SCENE, NULL); + + prop = RNA_def_property(srna, "force", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_default(prop, 0); + RNA_def_property_ui_text(prop, "Force", "Force object who has LANPR modifiers to follow the rule"); + +} + void RNA_def_collections(BlenderRNA *brna) { StructRNA *srna; @@ -457,6 +483,11 @@ void RNA_def_collections(BlenderRNA *brna) RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, -1); RNA_def_property_ui_text(prop, "Disable in Renders", "Globally disable in renders"); RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_Collection_flag_update"); + + rna_def_collection_lanpr(brna,srna); + prop = RNA_def_property(srna, "lanpr", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "CollectionLANPR"); + RNA_def_property_ui_text(prop, "LANPR", "LANPR settings for the collection"); } #endif _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs