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/blenkernel/intern/material.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/blenkernel/intern/material.c')
-rw-r--r-- | source/blender/blenkernel/intern/material.c | 75 |
1 files changed, 55 insertions, 20 deletions
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 368eb099579..15f18eef7c8 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -37,11 +37,14 @@ #include "DNA_meshdata_types.h" #include "DNA_customdata_types.h" #include "DNA_gpencil_types.h" +#include "DNA_hair_types.h" #include "DNA_ID.h" #include "DNA_meta_types.h" #include "DNA_node_types.h" #include "DNA_object_types.h" +#include "DNA_pointcloud_types.h" #include "DNA_scene_types.h" +#include "DNA_volume_types.h" #include "DNA_defaults.h" #include "BLI_math.h" @@ -243,53 +246,67 @@ Material *BKE_material_localize(Material *ma) Material ***BKE_object_material_array_p(Object *ob) { - Mesh *me; - Curve *cu; - MetaBall *mb; - bGPdata *gpd; - if (ob->type == OB_MESH) { - me = ob->data; + Mesh *me = ob->data; return &(me->mat); } else if (ELEM(ob->type, OB_CURVE, OB_FONT, OB_SURF)) { - cu = ob->data; + Curve *cu = ob->data; return &(cu->mat); } else if (ob->type == OB_MBALL) { - mb = ob->data; + MetaBall *mb = ob->data; return &(mb->mat); } else if (ob->type == OB_GPENCIL) { - gpd = ob->data; + bGPdata *gpd = ob->data; return &(gpd->mat); } + else if (ob->type == OB_HAIR) { + Hair *hair = ob->data; + return &(hair->mat); + } + else if (ob->type == OB_POINTCLOUD) { + PointCloud *pointcloud = ob->data; + return &(pointcloud->mat); + } + else if (ob->type == OB_VOLUME) { + Volume *volume = ob->data; + return &(volume->mat); + } return NULL; } short *BKE_object_material_len_p(Object *ob) { - Mesh *me; - Curve *cu; - MetaBall *mb; - bGPdata *gpd; - if (ob->type == OB_MESH) { - me = ob->data; + Mesh *me = ob->data; return &(me->totcol); } else if (ELEM(ob->type, OB_CURVE, OB_FONT, OB_SURF)) { - cu = ob->data; + Curve *cu = ob->data; return &(cu->totcol); } else if (ob->type == OB_MBALL) { - mb = ob->data; + MetaBall *mb = ob->data; return &(mb->totcol); } else if (ob->type == OB_GPENCIL) { - gpd = ob->data; + bGPdata *gpd = ob->data; return &(gpd->totcol); } + else if (ob->type == OB_HAIR) { + Hair *hair = ob->data; + return &(hair->totcol); + } + else if (ob->type == OB_POINTCLOUD) { + PointCloud *pointcloud = ob->data; + return &(pointcloud->totcol); + } + else if (ob->type == OB_VOLUME) { + Volume *volume = ob->data; + return &(volume->totcol); + } return NULL; } @@ -308,6 +325,12 @@ Material ***BKE_id_material_array_p(ID *id) return &(((MetaBall *)id)->mat); case ID_GD: return &(((bGPdata *)id)->mat); + case ID_HA: + return &(((Hair *)id)->mat); + case ID_PT: + return &(((PointCloud *)id)->mat); + case ID_VO: + return &(((Volume *)id)->mat); default: break; } @@ -328,6 +351,12 @@ short *BKE_id_material_len_p(ID *id) return &(((MetaBall *)id)->totcol); case ID_GD: return &(((bGPdata *)id)->totcol); + case ID_HA: + return &(((Hair *)id)->totcol); + case ID_PT: + return &(((PointCloud *)id)->totcol); + case ID_VO: + return &(((Volume *)id)->totcol); default: break; } @@ -347,7 +376,10 @@ static void material_data_index_remove_id(ID *id, short index) BKE_curve_material_index_remove((Curve *)id, index); break; case ID_MB: - /* meta-elems don't have materials atm */ + case ID_HA: + case ID_PT: + case ID_VO: + /* No material indices for these object data types. */ break; default: break; @@ -387,7 +419,10 @@ static void material_data_index_clear_id(ID *id) BKE_curve_material_index_clear((Curve *)id); break; case ID_MB: - /* meta-elems don't have materials atm */ + case ID_HA: + case ID_PT: + case ID_VO: + /* No material indices for these object data types. */ break; default: break; |