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
This commit is contained in:
Brecht Van Lommel
2020-03-17 14:41:48 +01:00
parent 8dcfd392e4
commit b0a1cf2c9a
118 changed files with 7093 additions and 156 deletions

View File

@@ -2157,6 +2157,16 @@ class VIEW3D_MT_camera_add(Menu):
layout.operator("object.camera_add", text="Camera", icon='OUTLINER_OB_CAMERA')
class VIEW3D_MT_volume_add(Menu):
bl_idname = "VIEW3D_MT_volume_add"
bl_label = "Volume"
def draw(self, _context):
layout = self.layout
layout.operator("object.volume_import", text="Import OpenVDB...", icon='OUTLINER_DATA_VOLUME')
layout.operator("object.volume_add", text="Empty", icon='OUTLINER_DATA_VOLUME')
class VIEW3D_MT_add(Menu):
bl_label = "Add"
bl_translation_context = i18n_contexts.operator_default
@@ -2179,6 +2189,11 @@ class VIEW3D_MT_add(Menu):
layout.menu("VIEW3D_MT_surface_add", icon='OUTLINER_OB_SURFACE')
layout.menu("VIEW3D_MT_metaball_add", text="Metaball", icon='OUTLINER_OB_META')
layout.operator("object.text_add", text="Text", icon='OUTLINER_OB_FONT')
if hasattr(bpy.data, "hairs"):
layout.operator("object.hair_add", text="Hair", icon='OUTLINER_OB_HAIR')
if hasattr(bpy.data, "pointclouds"):
layout.operator("object.pointcloud_add", text="Point Cloud", icon='OUTLINER_OB_POINTCLOUD')
layout.menu("VIEW3D_MT_volume_add", text="Volume", icon='OUTLINER_OB_VOLUME')
layout.operator_menu_enum("object.gpencil_add", "type", text="Grease Pencil", icon='OUTLINER_OB_GREASEPENCIL')
layout.separator()
@@ -5428,6 +5443,9 @@ class VIEW3D_PT_object_type_visibility(Panel):
("surf", "Surface"),
("meta", "Meta"),
("font", "Text"),
("hair", "Hair"),
("pointcloud", "Point Cloud"),
("volume", "Volume"),
("grease_pencil", "Grease Pencil"),
(None, None),
# Other
@@ -5445,6 +5463,11 @@ class VIEW3D_PT_object_type_visibility(Panel):
col.separator()
continue
if attr == "hair" and not hasattr(bpy.data, "hairs"):
continue
elif attr == "pointcloud" and not hasattr(bpy.data, "pointclouds"):
continue
attr_v = "show_object_viewport_" f"{attr:s}"
attr_s = "show_object_select_" f"{attr:s}"
@@ -7254,6 +7277,7 @@ classes = (
VIEW3D_MT_light_add,
VIEW3D_MT_lightprobe_add,
VIEW3D_MT_camera_add,
VIEW3D_MT_volume_add,
VIEW3D_MT_add,
VIEW3D_MT_image_add,
VIEW3D_MT_object,