[Bf-blender-cvs] [b0a1cf2c9ae] master: Objects: add Volume object type, and prototypes for Hair and PointCloud

Brecht Van Lommel noreply at git.blender.org
Wed Mar 18 11:23:44 CET 2020


Commit: b0a1cf2c9ae696b07f7a236bc855a5ab4a493dcb
Author: Brecht Van Lommel
Date:   Tue Mar 17 14:41:48 2020 +0100
Branches: master
https://developer.blender.org/rBb0a1cf2c9ae696b07f7a236bc855a5ab4a493dcb

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

===================================================================

M	CMakeLists.txt
M	release/scripts/startup/bl_ui/__init__.py
A	release/scripts/startup/bl_ui/properties_data_hair.py
A	release/scripts/startup/bl_ui/properties_data_pointcloud.py
A	release/scripts/startup/bl_ui/properties_data_volume.py
M	release/scripts/startup/bl_ui/properties_object.py
M	release/scripts/startup/bl_ui/space_dopesheet.py
M	release/scripts/startup/bl_ui/space_filebrowser.py
M	release/scripts/startup/bl_ui/space_node.py
M	release/scripts/startup/bl_ui/space_outliner.py
M	release/scripts/startup/bl_ui/space_userpref.py
M	release/scripts/startup/bl_ui/space_view3d.py
A	source/blender/blenkernel/BKE_hair.h
M	source/blender/blenkernel/BKE_idtype.h
M	source/blender/blenkernel/BKE_main.h
M	source/blender/blenkernel/BKE_packedFile.h
A	source/blender/blenkernel/BKE_pointcloud.h
A	source/blender/blenkernel/BKE_volume.h
M	source/blender/blenkernel/CMakeLists.txt
M	source/blender/blenkernel/intern/anim_sys.c
M	source/blender/blenkernel/intern/bpath.c
M	source/blender/blenkernel/intern/customdata.c
M	source/blender/blenkernel/intern/effect.c
A	source/blender/blenkernel/intern/hair.c
M	source/blender/blenkernel/intern/idcode.c
M	source/blender/blenkernel/intern/idtype.c
M	source/blender/blenkernel/intern/lib_id.c
M	source/blender/blenkernel/intern/lib_query.c
M	source/blender/blenkernel/intern/lib_remap.c
M	source/blender/blenkernel/intern/main.c
M	source/blender/blenkernel/intern/material.c
M	source/blender/blenkernel/intern/object.c
M	source/blender/blenkernel/intern/object_update.c
M	source/blender/blenkernel/intern/packedFile.c
A	source/blender/blenkernel/intern/pointcloud.c
A	source/blender/blenkernel/intern/volume.cc
M	source/blender/blenloader/intern/readblenentry.c
M	source/blender/blenloader/intern/readfile.c
M	source/blender/blenloader/intern/readfile.h
M	source/blender/blenloader/intern/writefile.c
M	source/blender/blentranslation/BLT_translation.h
M	source/blender/depsgraph/CMakeLists.txt
M	source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
M	source/blender/depsgraph/intern/builder/deg_builder_relations.cc
M	source/blender/depsgraph/intern/depsgraph_tag.cc
M	source/blender/depsgraph/intern/eval/deg_eval_runtime_backup.cc
M	source/blender/depsgraph/intern/eval/deg_eval_runtime_backup.h
M	source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_object.cc
A	source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_volume.cc
A	source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_volume.h
A	source/blender/draw/engines/overlay/overlay_pointcloud.c
A	source/blender/draw/engines/overlay/shaders/pointcloud_frag.glsl
A	source/blender/draw/engines/overlay/shaders/pointcloud_vert.glsl
A	source/blender/draw/intern/draw_cache_impl_hair.c
A	source/blender/draw/intern/draw_cache_impl_pointcloud.c
A	source/blender/draw/intern/draw_cache_impl_volume.c
M	source/blender/editors/animation/anim_channels_defines.c
M	source/blender/editors/animation/anim_channels_edit.c
M	source/blender/editors/animation/anim_filter.c
M	source/blender/editors/include/ED_anim_api.h
M	source/blender/editors/include/UI_icons.h
M	source/blender/editors/interface/interface_icons.c
M	source/blender/editors/interface/interface_templates.c
M	source/blender/editors/object/CMakeLists.txt
M	source/blender/editors/object/object_add.c
M	source/blender/editors/object/object_intern.h
M	source/blender/editors/object/object_modifier.c
M	source/blender/editors/object/object_ops.c
M	source/blender/editors/object/object_relations.c
A	source/blender/editors/object/object_volume.c
M	source/blender/editors/render/render_opengl.c
M	source/blender/editors/space_buttons/CMakeLists.txt
M	source/blender/editors/space_buttons/buttons_context.c
M	source/blender/editors/space_file/filelist.c
M	source/blender/editors/space_file/filesel.c
M	source/blender/editors/space_info/info_stats.c
M	source/blender/editors/space_nla/nla_buttons.c
M	source/blender/editors/space_nla/nla_channels.c
M	source/blender/editors/space_node/node_edit.c
M	source/blender/editors/space_outliner/outliner_draw.c
M	source/blender/editors/space_outliner/outliner_intern.h
M	source/blender/editors/space_outliner/outliner_tools.c
M	source/blender/editors/space_outliner/outliner_tree.c
M	source/blender/editors/space_view3d/space_view3d.c
M	source/blender/editors/space_view3d/view3d_buttons.c
M	source/blender/makesdna/DNA_ID.h
M	source/blender/makesdna/DNA_action_types.h
M	source/blender/makesdna/DNA_customdata_types.h
M	source/blender/makesdna/DNA_defaults.h
A	source/blender/makesdna/DNA_hair_defaults.h
A	source/blender/makesdna/DNA_hair_types.h
M	source/blender/makesdna/DNA_object_types.h
A	source/blender/makesdna/DNA_pointcloud_defaults.h
A	source/blender/makesdna/DNA_pointcloud_types.h
M	source/blender/makesdna/DNA_space_types.h
M	source/blender/makesdna/DNA_userdef_types.h
A	source/blender/makesdna/DNA_volume_defaults.h
A	source/blender/makesdna/DNA_volume_types.h
M	source/blender/makesdna/intern/CMakeLists.txt
M	source/blender/makesdna/intern/dna_defaults.c
M	source/blender/makesdna/intern/makesdna.c
M	source/blender/makesrna/RNA_access.h
M	source/blender/makesrna/RNA_types.h
M	source/blender/makesrna/intern/CMakeLists.txt
M	source/blender/makesrna/intern/makesrna.c
M	source/blender/makesrna/intern/rna_ID.c
M	source/blender/makesrna/intern/rna_action.c
A	source/blender/makesrna/intern/rna_hair.c
M	source/blender/makesrna/intern/rna_internal.h
M	source/blender/makesrna/intern/rna_main.c
M	source/blender/makesrna/intern/rna_main_api.c
M	source/blender/makesrna/intern/rna_object.c
A	source/blender/makesrna/intern/rna_pointcloud.c
M	source/blender/makesrna/intern/rna_space.c
M	source/blender/makesrna/intern/rna_userdef.c
A	source/blender/makesrna/intern/rna_volume.c
M	source/blender/windowmanager/intern/wm_operator_props.c
M	source/creator/creator.c

===================================================================

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9f4d0c20886..f71646f4aba 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -319,6 +319,10 @@ mark_as_advanced(WITH_SYSTEM_GLOG)
 # Freestyle
 option(WITH_FREESTYLE     "Enable Freestyle (advanced edges rendering)" ON)
 
+# New object types
+option(WITH_NEW_OBJECT_TYPES "Enable new hair and pointcloud objects (use for development only, don't save in files)" OFF)
+mark_as_advanced(WITH_NEW_OBJECT_TYPES)
+
 # Misc
 if(WIN32)
   option(WITH_INPUT_IME "Enable Input Method Editor (IME) for complex Asian character input" ON)
diff --git a/release/scripts/startup/bl_ui/__init__.py b/release/scripts/startup/bl_ui/__init__.py
index c2bcb7d5ea5..7d3ecceca41 100644
--- a/release/scripts/startup/bl_ui/__init__.py
+++ b/release/scripts/startup/bl_ui/__init__.py
@@ -35,14 +35,17 @@ _modules = [
     "properties_data_curve",
     "properties_data_empty",
     "properties_data_gpencil",
+    "properties_data_hair",
     "properties_data_light",
     "properties_data_lattice",
     "properties_data_mesh",
     "properties_data_metaball",
     "properties_data_modifier",
+    "properties_data_pointcloud",
     "properties_data_shaderfx",
     "properties_data_lightprobe",
     "properties_data_speaker",
+    "properties_data_volume",
     "properties_mask_common",
     "properties_material",
     "properties_material_gpencil",
diff --git a/release/scripts/startup/bl_ui/properties_data_hair.py b/release/scripts/startup/bl_ui/properties_data_hair.py
new file mode 100644
index 00000000000..6017765b83d
--- /dev/null
+++ b/release/scripts/startup/bl_ui/properties_data_hair.py
@@ -0,0 +1,78 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+#  This program is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU General Public License
+#  as published by the Free Software Foundation; either version 2
+#  of the License, or (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software Foundation,
+#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+import bpy
+from bpy.types import Panel, UIList
+from rna_prop_ui import PropertyPanel
+
+
+class DataButtonsPanel:
+    bl_space_type = 'PROPERTIES'
+    bl_region_type = 'WINDOW'
+    bl_context = "data"
+
+    @classmethod
+    def poll(cls, context):
+        engine = context.scene.render.engine
+        return hasattr(context, 'hair') and context.hair and (engine in cls.COMPAT_ENGINES)
+
+
+class DATA_PT_context_hair(DataButtonsPanel, Panel):
+    bl_label = ""
+    bl_options = {'HIDE_HEADER'}
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
+
+    def draw(self, context):
+        layout = self.layout
+
+        ob = context.object
+        hair = context.hair
+        space = context.space_data
+
+        if ob:
+            layout.template_ID(ob, "data")
+        elif hair:
+            layout.template_ID(space, "pin_id")
+
+
+class DATA_PT_hair(DataButtonsPanel, Panel):
+    bl_label = "Hair"
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
+
+    def draw(self, context):
+        layout = self.layout
+        hair = context.hair
+        pass
+
+class DATA_PT_custom_props_hair(DataButtonsPanel, PropertyPanel, Panel):
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
+    _context_path = "object.data"
+    _property_type = bpy.types.Hair if hasattr(bpy.types, "Hair") else None
+
+
+classes = (
+    DATA_PT_context_hair,
+    DATA_PT_hair,
+    DATA_PT_custom_props_hair,
+)
+
+if __name__ == "__main__":  # only for live edit.
+    from bpy.utils import register_class
+    for cls in classes:
+        register_class(cls)
diff --git a/release/scripts/startup/bl_ui/properties_data_pointcloud.py b/release/scripts/startup/bl_ui/properties_data_pointcloud.py
new file mode 100644
index 00000000000..10ebdea3155
--- /dev/null
+++ b/release/scripts/startup/bl_ui/properties_data_pointcloud.py
@@ -0,0 +1,78 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+#  This program is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU General Public License
+#  as published by the Free Software Foundation; either version 2
+#  of the License, or (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software Foundation,
+#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+import bpy
+from bpy.types import Panel, UIList
+from rna_prop_ui import PropertyPanel
+
+
+class DataButtonsPanel:
+    bl_space_type = 'PROPERTIES'
+    bl_region_type = 'WINDOW'
+    bl_context = "data"
+
+    @classmethod
+    def poll(cls, context):
+        engine = context.scene.render.engine
+        return hasattr(context, 'pointcloud') and context.pointcloud and (engine in cls.COMPAT_ENGINES)
+
+
+class DATA_PT_context_pointcloud(DataButtonsPanel, Panel):
+    bl_label = ""
+    bl_options = {'HIDE_HEADER'}
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
+
+    def draw(self, context):
+        layout = self.layout
+
+        ob = context.object
+        pointcloud = context.pointcloud
+        space = context.space_data
+
+        if ob:
+            layout.template_ID(ob, "data")
+        elif pointcloud:
+            layout.template_ID(space, "pin_id")
+
+
+class DATA_PT_pointcloud(DataButtonsPanel, Panel):
+    bl_label = "Point Cloud"
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
+
+    def draw(self, context):
+        layout = self.layout
+        pointcloud = context.pointcloud
+        pass
+
+class DATA_PT_custom_props_pointcloud(DataButtonsPanel, PropertyPanel, Panel):
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
+    _context_path = "object.data"
+    _property_type = bpy.types.PointCloud if hasattr(bpy.types, "PointCloud") else None
+
+
+classes = (
+    DATA_PT_context_pointcloud,
+    DATA_PT_pointcloud,
+    DATA_PT_custom_props_pointcloud,
+)
+
+if __name__ == "__main__":  # only for live edit.
+    from bpy.utils import register_class
+    for cls in classes:
+        register_class(cls)
diff --git a/release/scripts/startup/bl_ui/properties_data_volume.py b/release/scripts/startup/bl_ui/properties_data_volume.py
new file mode 100644
index 00000000000..29e28aa2c02
--- /dev/null
+++ b/release/scripts/startup/bl_ui/properties_data_volume.py
@@ -0,0 +1,173 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+#  This program is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU General Public License
+#  as published by the Free Software Foundation; either version 2
+#  of the License, or (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software Foundation,
+#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+import bpy
+from bpy.types import Panel, UIList
+from rna_prop_ui import PropertyPanel
+
+
+class DataButtonsPanel:
+    bl_space_type = 'PROPERTIES'
+    bl_region_type = 'WINDOW'
+    bl_context = "data"
+
+    @classmethod
+    def poll(cls, context):
+        engine = context.scene.render.engine
+        return context.volume and (engine in cls.COMPAT_ENGINES)
+
+
+class DATA_PT_context_volume(DataButtonsPanel, Panel):
+    bl_label = ""
+    bl_options = {'HIDE_HEADER'}
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
+
+    def draw(self, context):
+        layout = self.layout
+
+        ob = context.object
+        volume = context.volume
+        space = context.space_data
+
+        if ob:
+            layout.template_ID(ob, "data")
+        elif volume:
+            layout.template_ID(space, "pin_id")
+
+
+class DATA_PT_volume_file(DataButtonsPanel, Panel):
+    bl_label = "OpenVDB File"
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
+
+    def draw(self, context):
+        layout = self.layout
+
+        volume = context.volume
+        volume.grids.load()
+
+        layout.prop(volume, "filepath", text="")
+
+        if len(volume.filepath):
+            layout.use_property_split = True
+            layout.use_property_decorate = False
+
+            col = layout.column(align=True)
+            col.prop(volume, "is_sequence")
+            if volume.is_sequence:
+                col.prop(volume, "frame_duration", text="Frames")
+                col.prop(volume, "frame_start", text="Start")
+                col.prop(volume, "frame_offset", text="Offset")
+                col.prop(volume, "sequence_mode", text="Mode")
+
+        error_msg = volume.grids.error_message
+        if len(error_msg):
+          layout.separator()
+          col = layout.column(align=True)
+          col.label(text="Failed to load volume:")
+          col.label(text=error_msg)
+
+
+class VOLUME_UL_grids(UIList):
+    def draw_item(self, context, layout, data, grid, icon, active_data, active_propname, index):
+        name = grid.name
+        data_type = grid.bl_r

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list