diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2020-03-17 16:41:48 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2020-03-18 13:23:05 +0300 |
commit | b0a1cf2c9ae696b07f7a236bc855a5ab4a493dcb (patch) | |
tree | 92295af11db5e984da42bfac7ca60190b8549a3f /source/blender/editors/space_buttons/buttons_context.c | |
parent | 8dcfd392e4e62f193b666304425bc5ae635ecffe (diff) |
Objects: add Volume object type, and prototypes for Hair and PointCloud
Only the volume object is exposed in the user interface. It is based on OpenVDB
internally. Drawing and rendering code will follow in another commit.
https://wiki.blender.org/wiki/Source/Objects/Volume
https://wiki.blender.org/wiki/Reference/Release_Notes/2.83/Volumes
Hair and PointCloud object types are hidden behind a WITH_NEW_OBJECT_TYPES
build option. These are unfinished, and included only to make it easier to
cooperate on development in the future and avoid tricky merges.
https://wiki.blender.org/wiki/Source/Objects/New_Object_Types
Ref T73201, T68981
Differential Revision: https://developer.blender.org/D6945
Diffstat (limited to 'source/blender/editors/space_buttons/buttons_context.c')
-rw-r--r-- | source/blender/editors/space_buttons/buttons_context.c | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index 035239cc7d0..21dfb3df771 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -251,6 +251,17 @@ static int buttons_context_path_data(ButsContextPath *path, int type) else if (RNA_struct_is_a(ptr->type, &RNA_GreasePencil) && (type == -1 || type == OB_GPENCIL)) { return 1; } +#ifdef WITH_NEW_OBJECT_TYPES + else if (RNA_struct_is_a(ptr->type, &RNA_Hair) && (type == -1 || type == OB_HAIR)) { + return 1; + } + else if (RNA_struct_is_a(ptr->type, &RNA_PointCloud) && (type == -1 || type == OB_POINTCLOUD)) { + return 1; + } +#endif + else if (RNA_struct_is_a(ptr->type, &RNA_Volume) && (type == -1 || type == OB_VOLUME)) { + return 1; + } /* try to get an object in the path, no pinning supported here */ else if (buttons_context_path_object(path)) { ob = path->ptr[path->len - 1].data; @@ -274,7 +285,16 @@ static int buttons_context_path_modifier(ButsContextPath *path) if (buttons_context_path_object(path)) { ob = path->ptr[path->len - 1].data; - if (ob && ELEM(ob->type, OB_MESH, OB_CURVE, OB_FONT, OB_SURF, OB_LATTICE, OB_GPENCIL)) { + if (ob && ELEM(ob->type, + OB_MESH, + OB_CURVE, + OB_FONT, + OB_SURF, + OB_LATTICE, + OB_GPENCIL, + OB_HAIR, + OB_POINTCLOUD, + OB_VOLUME)) { return 1; } } @@ -776,6 +796,11 @@ const char *buttons_context_dir[] = { "line_style", "collection", "gpencil", +#ifdef WITH_NEW_OBJECT_TYPES + "hair", + "pointcloud", +#endif + "volume", NULL, }; @@ -853,6 +878,20 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r set_pointer_type(path, result, &RNA_LightProbe); return 1; } +#ifdef WITH_NEW_OBJECT_TYPES + else if (CTX_data_equals(member, "hair")) { + set_pointer_type(path, result, &RNA_Hair); + return 1; + } + else if (CTX_data_equals(member, "pointcloud")) { + set_pointer_type(path, result, &RNA_PointCloud); + return 1; + } +#endif + else if (CTX_data_equals(member, "volume")) { + set_pointer_type(path, result, &RNA_Volume); + return 1; + } else if (CTX_data_equals(member, "material")) { set_pointer_type(path, result, &RNA_Material); return 1; |