Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r--source/blender/makesrna/intern/CMakeLists.txt12
-rw-r--r--source/blender/makesrna/intern/makesrna.c7
-rw-r--r--source/blender/makesrna/intern/rna_ID.c32
-rw-r--r--source/blender/makesrna/intern/rna_action.c23
-rw-r--r--source/blender/makesrna/intern/rna_hair.c244
-rw-r--r--source/blender/makesrna/intern/rna_internal.h6
-rw-r--r--source/blender/makesrna/intern/rna_main.c22
-rw-r--r--source/blender/makesrna/intern/rna_main_api.c187
-rw-r--r--source/blender/makesrna/intern/rna_object.c13
-rw-r--r--source/blender/makesrna/intern/rna_pointcloud.c175
-rw-r--r--source/blender/makesrna/intern/rna_space.c39
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c17
-rw-r--r--source/blender/makesrna/intern/rna_volume.c557
13 files changed, 1327 insertions, 7 deletions
diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt
index 30989a62603..64b7a3e70c1 100644
--- a/source/blender/makesrna/intern/CMakeLists.txt
+++ b/source/blender/makesrna/intern/CMakeLists.txt
@@ -88,6 +88,7 @@ set(DEFSRC
rna_ui.c
rna_userdef.c
rna_vfont.c
+ rna_volume.c
rna_wm.c
rna_wm_gizmo.c
rna_workspace.c
@@ -95,6 +96,13 @@ set(DEFSRC
rna_xr.c
)
+if(WITH_NEW_OBJECT_TYPES)
+ list(APPEND DEFSRC
+ rna_hair.c
+ rna_pointcloud.c
+ )
+endif()
+
set(APISRC
rna_action_api.c
rna_animation_api.c
@@ -330,6 +338,10 @@ if(WITH_XR_OPENXR)
add_definitions(-DWITH_XR_OPENXR)
endif()
+if(WITH_NEW_OBJECT_TYPES)
+ add_definitions(-DWITH_NEW_OBJECT_TYPES)
+endif()
+
# Build makesrna executable
blender_include_dirs(
.
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c
index 7ec8f6167d0..3eaee4a1ef4 100644
--- a/source/blender/makesrna/intern/makesrna.c
+++ b/source/blender/makesrna/intern/makesrna.c
@@ -4265,6 +4265,9 @@ static RNAProcessItem PROCESS_ITEMS[] = {
{"rna_dynamicpaint.c", NULL, RNA_def_dynamic_paint},
{"rna_fcurve.c", "rna_fcurve_api.c", RNA_def_fcurve},
{"rna_gpencil.c", NULL, RNA_def_gpencil},
+#ifdef WITH_NEW_OBJECT_TYPES
+ {"rna_hair.c", NULL, RNA_def_hair},
+#endif
{"rna_image.c", "rna_image_api.c", RNA_def_image},
{"rna_key.c", NULL, RNA_def_key},
{"rna_light.c", NULL, RNA_def_light},
@@ -4287,6 +4290,9 @@ static RNAProcessItem PROCESS_ITEMS[] = {
{"rna_packedfile.c", NULL, RNA_def_packedfile},
{"rna_palette.c", NULL, RNA_def_palette},
{"rna_particle.c", NULL, RNA_def_particle},
+#ifdef WITH_NEW_OBJECT_TYPES
+ {"rna_pointcloud.c", NULL, RNA_def_pointcloud},
+#endif
{"rna_pose.c", "rna_pose_api.c", RNA_def_pose},
{"rna_curveprofile.c", NULL, RNA_def_profile},
{"rna_lightprobe.c", NULL, RNA_def_lightprobe},
@@ -4305,6 +4311,7 @@ static RNAProcessItem PROCESS_ITEMS[] = {
{"rna_ui.c", "rna_ui_api.c", RNA_def_ui},
{"rna_userdef.c", NULL, RNA_def_userdef},
{"rna_vfont.c", "rna_vfont_api.c", RNA_def_vfont},
+ {"rna_volume.c", NULL, RNA_def_volume},
{"rna_wm.c", "rna_wm_api.c", RNA_def_wm},
{"rna_wm_gizmo.c", "rna_wm_gizmo_api.c", RNA_def_wm_gizmo},
{"rna_workspace.c", "rna_workspace_api.c", RNA_def_workspace},
diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c
index bd5c7e755d6..9a660153a3b 100644
--- a/source/blender/makesrna/intern/rna_ID.c
+++ b/source/blender/makesrna/intern/rna_ID.c
@@ -75,6 +75,11 @@ const EnumPropertyItem rna_enum_id_type_items[] = {
{ID_SPK, "SPEAKER", ICON_SPEAKER, "Speaker", ""},
{ID_TXT, "TEXT", ICON_TEXT, "Text", ""},
{ID_TE, "TEXTURE", ICON_TEXTURE_DATA, "Texture", ""},
+#ifdef WITH_NEW_OBJECT_TYPES
+ {ID_HA, "HAIR", ICON_HAIR_DATA, "Hair", ""},
+ {ID_PT, "POINTCLOUD", ICON_POINTCLOUD_DATA, "PointCloud", ""},
+#endif
+ {ID_VO, "VOLUME", ICON_VOLUME_DATA, "Volume", ""},
{ID_WM, "WINDOWMANAGER", ICON_WINDOW, "Window Manager", ""},
{ID_WO, "WORLD", ICON_WORLD_DATA, "World", ""},
{ID_WS, "WORKSPACE", ICON_WORKSPACE, "Workspace", ""},
@@ -246,6 +251,11 @@ short RNA_type_to_ID_code(const StructRNA *type)
if (base_type == &RNA_FreestyleLineStyle) {
return ID_LS;
}
+# ifdef WITH_NEW_OBJECT_TYPES
+ if (base_type == &RNA_Hair) {
+ return ID_HA;
+ }
+# endif
if (base_type == &RNA_Lattice) {
return ID_LT;
}
@@ -279,6 +289,11 @@ short RNA_type_to_ID_code(const StructRNA *type)
if (base_type == &RNA_PaintCurve) {
return ID_PC;
}
+# ifdef WITH_NEW_OBJECT_TYPES
+ if (base_type == &RNA_PointCloud) {
+ return ID_PT;
+ }
+# endif
if (base_type == &RNA_LightProbe) {
return ID_LP;
}
@@ -303,6 +318,9 @@ short RNA_type_to_ID_code(const StructRNA *type)
if (base_type == &RNA_VectorFont) {
return ID_VF;
}
+ if (base_type == &RNA_Volume) {
+ return ID_VO;
+ }
if (base_type == &RNA_WorkSpace) {
return ID_WS;
}
@@ -337,6 +355,12 @@ StructRNA *ID_code_to_RNA_type(short idcode)
return &RNA_GreasePencil;
case ID_GR:
return &RNA_Collection;
+ case ID_HA:
+# ifdef WITH_NEW_OBJECT_TYPES
+ return &RNA_Hair;
+# else
+ return &RNA_ID;
+# endif
case ID_IM:
return &RNA_Image;
case ID_KE:
@@ -369,6 +393,12 @@ StructRNA *ID_code_to_RNA_type(short idcode)
return &RNA_Palette;
case ID_PC:
return &RNA_PaintCurve;
+ case ID_PT:
+# ifdef WITH_NEW_OBJECT_TYPES
+ return &RNA_PointCloud;
+# else
+ return &RNA_ID;
+# endif
case ID_LP:
return &RNA_LightProbe;
case ID_SCE:
@@ -385,6 +415,8 @@ StructRNA *ID_code_to_RNA_type(short idcode)
return &RNA_Text;
case ID_VF:
return &RNA_VectorFont;
+ case ID_VO:
+ return &RNA_Volume;
case ID_WM:
return &RNA_WindowManager;
case ID_WO:
diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c
index c85a94d9fc2..a9dfa8b529e 100644
--- a/source/blender/makesrna/intern/rna_action.c
+++ b/source/blender/makesrna/intern/rna_action.c
@@ -568,6 +568,29 @@ static void rna_def_dopesheet(BlenderRNA *brna)
RNA_def_property_ui_icon(prop, ICON_FILE, 0);
RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+# ifdef WITH_NEW_OBJECT_TYPES
+ prop = RNA_def_property(srna, "show_hairs", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag2", ADS_FILTER_NOHAIR);
+ RNA_def_property_ui_text(
+ prop, "Display Hair", "Include visualization of hair related animation data");
+ RNA_def_property_ui_icon(prop, ICON_OUTLINER_OB_HAIR, 0);
+ RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+
+ prop = RNA_def_property(srna, "show_pointclouds", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag2", ADS_FILTER_NOPOINTCLOUD);
+ RNA_def_property_ui_text(
+ prop, "Display Point Cloud", "Include visualization of point cloud related animation data");
+ RNA_def_property_ui_icon(prop, ICON_OUTLINER_OB_POINTCLOUD, 0);
+ RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+# endif
+
+ prop = RNA_def_property(srna, "show_volumes", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag2", ADS_FILTER_NOVOLUME);
+ RNA_def_property_ui_text(
+ prop, "Display Volume", "Include visualization of volume related animation data");
+ RNA_def_property_ui_icon(prop, ICON_OUTLINER_OB_VOLUME, 0);
+ RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+
prop = RNA_def_property(srna, "show_gpencil", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOGPENCIL);
RNA_def_property_ui_text(
diff --git a/source/blender/makesrna/intern/rna_hair.c b/source/blender/makesrna/intern/rna_hair.c
new file mode 100644
index 00000000000..13f3132b7b8
--- /dev/null
+++ b/source/blender/makesrna/intern/rna_hair.c
@@ -0,0 +1,244 @@
+/*
+ * ***** 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.
+ *
+ * Contributor(s): Jörg Müller.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/makesrna/intern/rna_hair.c
+ * \ingroup RNA
+ */
+
+#include <stdlib.h>
+
+#include "RNA_define.h"
+#include "RNA_enum_types.h"
+
+#include "rna_internal.h"
+
+#include "DNA_hair_types.h"
+
+#include "BLI_math_base.h"
+#include "BLI_string.h"
+
+#ifdef RNA_RUNTIME
+
+# include "BLI_math_vector.h"
+
+# include "BKE_hair.h"
+
+# include "DEG_depsgraph.h"
+
+# include "WM_api.h"
+# include "WM_types.h"
+
+static Hair *rna_hair(PointerRNA *ptr)
+{
+ return (Hair *)ptr->owner_id;
+}
+
+static int rna_HairPoint_index_get(PointerRNA *ptr)
+{
+ const Hair *hair = rna_hair(ptr);
+ const float(*co)[3] = ptr->data;
+ return (int)(co - hair->co);
+}
+
+static void rna_HairPoint_location_get(PointerRNA *ptr, float value[3])
+{
+ copy_v3_v3(value, (const float *)ptr->data);
+}
+
+static void rna_HairPoint_location_set(PointerRNA *ptr, const float value[3])
+{
+ copy_v3_v3((float *)ptr->data, value);
+}
+
+static float rna_HairPoint_radius_get(PointerRNA *ptr)
+{
+ const Hair *hair = rna_hair(ptr);
+ if (hair->radius == NULL) {
+ return 0.0f;
+ }
+ const float(*co)[3] = ptr->data;
+ return hair->radius[co - hair->co];
+}
+
+static void rna_HairPoint_radius_set(PointerRNA *ptr, float value)
+{
+ const Hair *hair = rna_hair(ptr);
+ if (hair->radius == NULL) {
+ return;
+ }
+ const float(*co)[3] = ptr->data;
+ hair->radius[co - hair->co] = value;
+}
+
+static char *rna_HairPoint_path(PointerRNA *ptr)
+{
+ return BLI_sprintfN("points[%d]", rna_HairPoint_index_get(ptr));
+}
+
+static int rna_HairCurve_index_get(PointerRNA *ptr)
+{
+ Hair *hair = rna_hair(ptr);
+ return (int)((HairCurve *)ptr->data - hair->curves);
+}
+
+static char *rna_HairCurve_path(PointerRNA *ptr)
+{
+ return BLI_sprintfN("curves[%d]", rna_HairCurve_index_get(ptr));
+}
+
+static void rna_HairCurve_points_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
+{
+ Hair *hair = rna_hair(ptr);
+ HairCurve *curve = ptr->data;
+ float(*co)[3] = hair->co + curve->firstpoint;
+ rna_iterator_array_begin(iter, co, sizeof(float[3]), curve->numpoints, 0, NULL);
+}
+
+static int rna_HairCurve_points_length(PointerRNA *ptr)
+{
+ HairCurve *curve = ptr->data;
+ return curve->numpoints;
+}
+
+static void rna_Hair_update_data(struct Main *UNUSED(bmain),
+ struct Scene *UNUSED(scene),
+ PointerRNA *ptr)
+{
+ ID *id = ptr->owner_id;
+
+ /* cheating way for importers to avoid slow updates */
+ if (id->us > 0) {
+ DEG_id_tag_update(id, 0);
+ WM_main_add_notifier(NC_GEOM | ND_DATA, id);
+ }
+}
+
+#else
+
+static void rna_def_hair_point(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "HairPoint", NULL);
+ RNA_def_struct_ui_text(srna, "Hair Point", "Hair curve control point");
+ RNA_def_struct_path_func(srna, "rna_HairPoint_path");
+
+ prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_float_funcs(
+ prop, "rna_HairPoint_location_get", "rna_HairPoint_location_set", NULL);
+ RNA_def_property_ui_text(prop, "Location", "");
+ RNA_def_property_update(prop, 0, "rna_Hair_update_data");
+
+ prop = RNA_def_property(srna, "radius", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_funcs(prop, "rna_HairPoint_radius_get", "rna_HairPoint_radius_set", NULL);
+ RNA_def_property_ui_text(prop, "Radius", "");
+ RNA_def_property_update(prop, 0, "rna_Hair_update_data");
+
+ prop = RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_int_funcs(prop, "rna_HairPoint_index_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Index", "Index of this points");
+}
+
+static void rna_def_hair_curve(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "HairCurve", NULL);
+ RNA_def_struct_ui_text(srna, "Hair Curve", "Hair curve");
+ RNA_def_struct_path_func(srna, "rna_HairCurve_path");
+
+ prop = RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "HairPoint");
+ RNA_def_property_ui_text(prop, "Points", "Control points of the curve");
+ RNA_def_property_collection_funcs(prop,
+ "rna_HairCurve_points_begin",
+ "rna_iterator_array_next",
+ "rna_iterator_array_end",
+ "rna_iterator_array_get",
+ "rna_HairCurve_points_length",
+ NULL,
+ NULL,
+ NULL);
+
+ /* TODO: naming consistency, editable? */
+ prop = RNA_def_property(srna, "first_point_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "firstpoint");
+ RNA_def_property_ui_text(prop, "First Point Index", "Index of the first loop of this polygon");
+
+ prop = RNA_def_property(srna, "num_points", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "numpoints");
+ RNA_def_property_ui_text(prop, "Number of Points", "Number of loops used by this polygon");
+
+ prop = RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_int_funcs(prop, "rna_HairCurve_index_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Index", "Index of this curve");
+}
+
+static void rna_def_hair(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "Hair", "ID");
+ RNA_def_struct_ui_text(srna, "Hair", "Hair data-block for hair curves");
+ RNA_def_struct_ui_icon(srna, ICON_HAIR_DATA);
+
+ /* geometry */
+ prop = RNA_def_property(srna, "curves", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "curves", "totcurve");
+ RNA_def_property_struct_type(prop, "HairCurve");
+ RNA_def_property_ui_text(prop, "Curves", "All hair curves");
+
+ /* TODO: better solution for (*co)[3] parsing issue. */
+ RNA_define_verify_sdna(0);
+ prop = RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "co", "totpoint");
+ RNA_def_property_struct_type(prop, "HairPoint");
+ RNA_def_property_ui_text(prop, "Points", "Control points of all hair curves");
+ RNA_define_verify_sdna(1);
+
+ /* materials */
+ prop = RNA_def_property(srna, "materials", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol");
+ RNA_def_property_struct_type(prop, "Material");
+ RNA_def_property_ui_text(prop, "Materials", "");
+ RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.c */
+ RNA_def_property_collection_funcs(
+ prop, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "rna_IDMaterials_assign_int");
+
+ /* common */
+ rna_def_animdata_common(srna);
+}
+
+void RNA_def_hair(BlenderRNA *brna)
+{
+ rna_def_hair_point(brna);
+ rna_def_hair_curve(brna);
+ rna_def_hair(brna);
+}
+
+#endif
diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h
index 3e18e882e2b..27097261930 100644
--- a/source/blender/makesrna/intern/rna_internal.h
+++ b/source/blender/makesrna/intern/rna_internal.h
@@ -159,6 +159,7 @@ void RNA_def_fcurve(struct BlenderRNA *brna);
void RNA_def_gpencil(struct BlenderRNA *brna);
void RNA_def_greasepencil_modifier(struct BlenderRNA *brna);
void RNA_def_shader_fx(struct BlenderRNA *brna);
+void RNA_def_hair(struct BlenderRNA *brna);
void RNA_def_image(struct BlenderRNA *brna);
void RNA_def_key(struct BlenderRNA *brna);
void RNA_def_light(struct BlenderRNA *brna);
@@ -176,6 +177,7 @@ void RNA_def_object_force(struct BlenderRNA *brna);
void RNA_def_packedfile(struct BlenderRNA *brna);
void RNA_def_palette(struct BlenderRNA *brna);
void RNA_def_particle(struct BlenderRNA *brna);
+void RNA_def_pointcloud(struct BlenderRNA *brna);
void RNA_def_pose(struct BlenderRNA *brna);
void RNA_def_profile(struct BlenderRNA *brna);
void RNA_def_lightprobe(struct BlenderRNA *brna);
@@ -198,6 +200,7 @@ void RNA_def_sound(struct BlenderRNA *brna);
void RNA_def_ui(struct BlenderRNA *brna);
void RNA_def_userdef(struct BlenderRNA *brna);
void RNA_def_vfont(struct BlenderRNA *brna);
+void RNA_def_volume(struct BlenderRNA *brna);
void RNA_def_wm(struct BlenderRNA *brna);
void RNA_def_wm_gizmo(struct BlenderRNA *brna);
void RNA_def_workspace(struct BlenderRNA *brna);
@@ -443,6 +446,9 @@ void RNA_def_main_cachefiles(BlenderRNA *brna, PropertyRNA *cprop);
void RNA_def_main_paintcurves(BlenderRNA *brna, PropertyRNA *cprop);
void RNA_def_main_workspaces(BlenderRNA *brna, PropertyRNA *cprop);
void RNA_def_main_lightprobes(BlenderRNA *brna, PropertyRNA *cprop);
+void RNA_def_main_hairs(BlenderRNA *brna, PropertyRNA *cprop);
+void RNA_def_main_pointclouds(BlenderRNA *brna, PropertyRNA *cprop);
+void RNA_def_main_volumes(BlenderRNA *brna, PropertyRNA *cprop);
/* ID Properties */
diff --git a/source/blender/makesrna/intern/rna_main.c b/source/blender/makesrna/intern/rna_main.c
index 41de02a738f..949a7e44feb 100644
--- a/source/blender/makesrna/intern/rna_main.c
+++ b/source/blender/makesrna/intern/rna_main.c
@@ -109,6 +109,9 @@ RNA_MAIN_LISTBASE_FUNCS_DEF(collections)
RNA_MAIN_LISTBASE_FUNCS_DEF(curves)
RNA_MAIN_LISTBASE_FUNCS_DEF(fonts)
RNA_MAIN_LISTBASE_FUNCS_DEF(gpencils)
+# ifdef WITH_NEW_OBJECT_TYPES
+RNA_MAIN_LISTBASE_FUNCS_DEF(hairs)
+# endif
RNA_MAIN_LISTBASE_FUNCS_DEF(images)
RNA_MAIN_LISTBASE_FUNCS_DEF(lattices)
RNA_MAIN_LISTBASE_FUNCS_DEF(libraries)
@@ -125,6 +128,9 @@ RNA_MAIN_LISTBASE_FUNCS_DEF(objects)
RNA_MAIN_LISTBASE_FUNCS_DEF(paintcurves)
RNA_MAIN_LISTBASE_FUNCS_DEF(palettes)
RNA_MAIN_LISTBASE_FUNCS_DEF(particles)
+# ifdef WITH_NEW_OBJECT_TYPES
+RNA_MAIN_LISTBASE_FUNCS_DEF(pointclouds)
+# endif
RNA_MAIN_LISTBASE_FUNCS_DEF(scenes)
RNA_MAIN_LISTBASE_FUNCS_DEF(screens)
RNA_MAIN_LISTBASE_FUNCS_DEF(shapekeys)
@@ -132,6 +138,7 @@ RNA_MAIN_LISTBASE_FUNCS_DEF(sounds)
RNA_MAIN_LISTBASE_FUNCS_DEF(speakers)
RNA_MAIN_LISTBASE_FUNCS_DEF(texts)
RNA_MAIN_LISTBASE_FUNCS_DEF(textures)
+RNA_MAIN_LISTBASE_FUNCS_DEF(volumes)
RNA_MAIN_LISTBASE_FUNCS_DEF(wm)
RNA_MAIN_LISTBASE_FUNCS_DEF(workspaces)
RNA_MAIN_LISTBASE_FUNCS_DEF(worlds)
@@ -380,6 +387,21 @@ void RNA_def_main(BlenderRNA *brna)
"LightProbes",
"LightProbe data-blocks",
RNA_def_main_lightprobes},
+# ifdef WITH_NEW_OBJECT_TYPES
+ {"hairs", "Hair", "rna_Main_hairs_begin", "Hairs", "Hair data-blocks", RNA_def_main_hairs},
+ {"pointclouds",
+ "PointCloud",
+ "rna_Main_pointclouds_begin",
+ "Point Clouds",
+ "Point cloud data-blocks",
+ RNA_def_main_pointclouds},
+# endif
+ {"volumes",
+ "Volume",
+ "rna_Main_volumes_begin",
+ "Volumes",
+ "Volume data-blocks",
+ RNA_def_main_volumes},
{NULL, NULL, NULL, NULL, NULL, NULL},
};
diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c
index bb851365997..dfd94ccc927 100644
--- a/source/blender/makesrna/intern/rna_main_api.c
+++ b/source/blender/makesrna/intern/rna_main_api.c
@@ -49,6 +49,7 @@
# include "BKE_displist.h"
# include "BKE_font.h"
# include "BKE_gpencil.h"
+# include "BKE_hair.h"
# include "BKE_icons.h"
# include "BKE_idcode.h"
# include "BKE_image.h"
@@ -66,11 +67,13 @@
# include "BKE_object.h"
# include "BKE_paint.h"
# include "BKE_particle.h"
+# include "BKE_pointcloud.h"
# include "BKE_scene.h"
# include "BKE_sound.h"
# include "BKE_speaker.h"
# include "BKE_text.h"
# include "BKE_texture.h"
+# include "BKE_volume.h"
# include "BKE_workspace.h"
# include "BKE_world.h"
@@ -80,6 +83,7 @@
# include "DNA_armature_types.h"
# include "DNA_camera_types.h"
# include "DNA_curve_types.h"
+# include "DNA_hair_types.h"
# include "DNA_light_types.h"
# include "DNA_material_types.h"
# include "DNA_mesh_types.h"
@@ -94,7 +98,9 @@
# include "DNA_meta_types.h"
# include "DNA_world_types.h"
# include "DNA_particle_types.h"
+# include "DNA_pointcloud_types.h"
# include "DNA_vfont_types.h"
+# include "DNA_volume_types.h"
# include "DNA_node_types.h"
# include "DNA_movieclip_types.h"
# include "DNA_mask_types.h"
@@ -253,6 +259,15 @@ static Object *rna_Main_objects_new(Main *bmain, ReportList *reports, const char
case ID_LP:
type = OB_LIGHTPROBE;
break;
+ case ID_HA:
+ type = OB_HAIR;
+ break;
+ case ID_PT:
+ type = OB_POINTCLOUD;
+ break;
+ case ID_VO:
+ type = OB_VOLUME;
+ break;
default: {
const char *idname;
if (RNA_enum_id_from_value(rna_enum_id_type_items, GS(data->name), &idname) == 0) {
@@ -691,6 +706,38 @@ static bGPdata *rna_Main_gpencils_new(Main *bmain, const char *name)
return gpd;
}
+# ifdef WITH_NEW_OBJECT_TYPES
+static Hair *rna_Main_hairs_new(Main *bmain, const char *name)
+{
+ char safe_name[MAX_ID_NAME - 2];
+ rna_idname_validate(name, safe_name);
+
+ Hair *hair = BKE_hair_add(bmain, safe_name);
+ id_us_min(&hair->id);
+ return hair;
+}
+
+static PointCloud *rna_Main_pointclouds_new(Main *bmain, const char *name)
+{
+ char safe_name[MAX_ID_NAME - 2];
+ rna_idname_validate(name, safe_name);
+
+ PointCloud *pointcloud = BKE_pointcloud_add(bmain, safe_name);
+ id_us_min(&pointcloud->id);
+ return pointcloud;
+}
+# endif
+
+static Volume *rna_Main_volumes_new(Main *bmain, const char *name)
+{
+ char safe_name[MAX_ID_NAME - 2];
+ rna_idname_validate(name, safe_name);
+
+ Volume *volume = BKE_volume_add(bmain, safe_name);
+ id_us_min(&volume->id);
+ return volume;
+}
+
/* tag functions, all the same */
# define RNA_MAIN_ID_TAG_FUNCS_DEF(_func_name, _listbase_name, _id_type) \
static void rna_Main_##_func_name##_tag(Main *bmain, bool value) \
@@ -733,6 +780,11 @@ RNA_MAIN_ID_TAG_FUNCS_DEF(cachefiles, cachefiles, ID_CF)
RNA_MAIN_ID_TAG_FUNCS_DEF(paintcurves, paintcurves, ID_PC)
RNA_MAIN_ID_TAG_FUNCS_DEF(workspaces, workspaces, ID_WS)
RNA_MAIN_ID_TAG_FUNCS_DEF(lightprobes, lightprobes, ID_LP)
+# ifdef WITH_NEW_OBJECT_TYPES
+RNA_MAIN_ID_TAG_FUNCS_DEF(hairs, hairs, ID_HA)
+RNA_MAIN_ID_TAG_FUNCS_DEF(pointclouds, pointclouds, ID_PT)
+# endif
+RNA_MAIN_ID_TAG_FUNCS_DEF(volumes, volumes, ID_VO)
# undef RNA_MAIN_ID_TAG_FUNCS_DEF
@@ -2117,4 +2169,139 @@ void RNA_def_main_lightprobes(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
+void RNA_def_main_hairs(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "BlendDataHairs");
+ srna = RNA_def_struct(brna, "BlendDataHairs", NULL);
+ RNA_def_struct_sdna(srna, "Main");
+ RNA_def_struct_ui_text(srna, "Main Hairs", "Collection of hairs");
+
+ func = RNA_def_function(srna, "new", "rna_Main_hairs_new");
+ RNA_def_function_ui_description(func, "Add a new hair to the main database");
+ parm = RNA_def_string(func, "name", "Hair", 0, "", "New name for the data-block");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return type */
+ parm = RNA_def_pointer(func, "hair", "Hair", "", "New hair data-block");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Remove a hair from the current blendfile");
+ parm = RNA_def_pointer(func, "hair", "Hair", "", "Hair to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_boolean(func,
+ "do_unlink",
+ true,
+ "",
+ "Unlink all usages of this hair before deleting it "
+ "(WARNING: will also delete objects instancing that hair data)");
+ RNA_def_boolean(func,
+ "do_id_user",
+ true,
+ "",
+ "Decrement user counter of all datablocks used by this hair data");
+ RNA_def_boolean(
+ func, "do_ui_user", true, "", "Make sure interface does not reference this hair data");
+
+ func = RNA_def_function(srna, "tag", "rna_Main_hairs_tag");
+ parm = RNA_def_boolean(func, "value", 0, "Value", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+}
+
+void RNA_def_main_pointclouds(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "BlendDataPointClouds");
+ srna = RNA_def_struct(brna, "BlendDataPointClouds", NULL);
+ RNA_def_struct_sdna(srna, "Main");
+ RNA_def_struct_ui_text(srna, "Main Point Clouds", "Collection of point clouds");
+
+ func = RNA_def_function(srna, "new", "rna_Main_pointclouds_new");
+ RNA_def_function_ui_description(func, "Add a new point cloud to the main database");
+ parm = RNA_def_string(func, "name", "PointCloud", 0, "", "New name for the data-block");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return type */
+ parm = RNA_def_pointer(func, "pointcloud", "PointCloud", "", "New point cloud data-block");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Remove a point cloud from the current blendfile");
+ parm = RNA_def_pointer(func, "pointcloud", "PointCloud", "", "Point cloud to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_boolean(func,
+ "do_unlink",
+ true,
+ "",
+ "Unlink all usages of this point cloud before deleting it "
+ "(WARNING: will also delete objects instancing that point cloud data)");
+ RNA_def_boolean(func,
+ "do_id_user",
+ true,
+ "",
+ "Decrement user counter of all datablocks used by this point cloud data");
+ RNA_def_boolean(func,
+ "do_ui_user",
+ true,
+ "",
+ "Make sure interface does not reference this point cloud data");
+
+ func = RNA_def_function(srna, "tag", "rna_Main_pointclouds_tag");
+ parm = RNA_def_boolean(func, "value", 0, "Value", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+}
+
+void RNA_def_main_volumes(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "BlendDataVolumes");
+ srna = RNA_def_struct(brna, "BlendDataVolumes", NULL);
+ RNA_def_struct_sdna(srna, "Main");
+ RNA_def_struct_ui_text(srna, "Main Volumes", "Collection of volumes");
+
+ func = RNA_def_function(srna, "new", "rna_Main_volumes_new");
+ RNA_def_function_ui_description(func, "Add a new volume to the main database");
+ parm = RNA_def_string(func, "name", "Volume", 0, "", "New name for the data-block");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return type */
+ parm = RNA_def_pointer(func, "volume", "Volume", "", "New volume data-block");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Remove a volume from the current blendfile");
+ parm = RNA_def_pointer(func, "volume", "Volume", "", "Volume to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_boolean(func,
+ "do_unlink",
+ true,
+ "",
+ "Unlink all usages of this volume before deleting it "
+ "(WARNING: will also delete objects instancing that volume data)");
+ RNA_def_boolean(func,
+ "do_id_user",
+ true,
+ "",
+ "Decrement user counter of all datablocks used by this volume data");
+ RNA_def_boolean(
+ func, "do_ui_user", true, "", "Make sure interface does not reference this volume data");
+
+ func = RNA_def_function(srna, "tag", "rna_Main_volumes_tag");
+ parm = RNA_def_boolean(func, "value", 0, "Value", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+}
+
#endif
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 78f5cfb60b2..269dd08dd36 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -234,6 +234,11 @@ const EnumPropertyItem rna_enum_object_type_items[] = {
OBTYPE_CU_SURF,
{OB_MBALL, "META", 0, "Meta", ""},
OBTYPE_CU_FONT,
+#ifdef WITH_NEW_OBJECT_TYPES
+ {OB_HAIR, "HAIR", 0, "Hair", ""},
+ {OB_POINTCLOUD, "POINTCLOUD", 0, "PointCloud", ""},
+#endif
+ {OB_VOLUME, "VOLUME", 0, "Volume", ""},
{0, "", 0, NULL, NULL},
{OB_ARMATURE, "ARMATURE", 0, "Armature", ""},
{OB_LATTICE, "LATTICE", 0, "Lattice", ""},
@@ -552,6 +557,14 @@ static StructRNA *rna_Object_data_typef(PointerRNA *ptr)
return &RNA_LightProbe;
case OB_GPENCIL:
return &RNA_GreasePencil;
+# ifdef WITH_NEW_OBJECT_TYPES
+ case OB_HAIR:
+ return &RNA_Hair;
+ case OB_POINTCLOUD:
+ return &RNA_PointCloud;
+# endif
+ case OB_VOLUME:
+ return &RNA_Volume;
default:
return &RNA_ID;
}
diff --git a/source/blender/makesrna/intern/rna_pointcloud.c b/source/blender/makesrna/intern/rna_pointcloud.c
new file mode 100644
index 00000000000..d62fa6dc3fc
--- /dev/null
+++ b/source/blender/makesrna/intern/rna_pointcloud.c
@@ -0,0 +1,175 @@
+/*
+ * ***** 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.
+ *
+ * Contributor(s): Jörg Müller.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/makesrna/intern/rna_pointcloud.c
+ * \ingroup RNA
+ */
+
+#include <stdlib.h>
+
+#include "RNA_define.h"
+#include "RNA_enum_types.h"
+
+#include "rna_internal.h"
+
+#include "DNA_pointcloud_types.h"
+
+#include "BLI_math_base.h"
+#include "BLI_string.h"
+
+#ifdef RNA_RUNTIME
+
+# include "BLI_math_vector.h"
+
+# include "BKE_pointcloud.h"
+
+# include "DEG_depsgraph.h"
+
+# include "WM_api.h"
+# include "WM_types.h"
+
+static PointCloud *rna_pointcloud(PointerRNA *ptr)
+{
+ return (PointCloud *)ptr->owner_id;
+}
+
+static int rna_Point_index_get(PointerRNA *ptr)
+{
+ const PointCloud *pointcloud = rna_pointcloud(ptr);
+ const float(*co)[3] = ptr->data;
+ return (int)(co - pointcloud->co);
+}
+
+static void rna_Point_location_get(PointerRNA *ptr, float value[3])
+{
+ copy_v3_v3(value, (const float *)ptr->data);
+}
+
+static void rna_Point_location_set(PointerRNA *ptr, const float value[3])
+{
+ copy_v3_v3((float *)ptr->data, value);
+}
+
+static float rna_Point_radius_get(PointerRNA *ptr)
+{
+ const PointCloud *pointcloud = rna_pointcloud(ptr);
+ if (pointcloud->radius == NULL) {
+ return 0.0f;
+ }
+ const float(*co)[3] = ptr->data;
+ return pointcloud->radius[co - pointcloud->co];
+}
+
+static void rna_Point_radius_set(PointerRNA *ptr, float value)
+{
+ const PointCloud *pointcloud = rna_pointcloud(ptr);
+ if (pointcloud->radius == NULL) {
+ return;
+ }
+ const float(*co)[3] = ptr->data;
+ pointcloud->radius[co - pointcloud->co] = value;
+}
+
+static char *rna_Point_path(PointerRNA *ptr)
+{
+ return BLI_sprintfN("points[%d]", rna_Point_index_get(ptr));
+}
+
+static void rna_PointCloud_update_data(struct Main *UNUSED(bmain),
+ struct Scene *UNUSED(scene),
+ PointerRNA *ptr)
+{
+ ID *id = ptr->owner_id;
+
+ /* cheating way for importers to avoid slow updates */
+ if (id->us > 0) {
+ DEG_id_tag_update(id, 0);
+ WM_main_add_notifier(NC_GEOM | ND_DATA, id);
+ }
+}
+
+#else
+
+static void rna_def_point(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "Point", NULL);
+ RNA_def_struct_ui_text(srna, "Point", "Point in a point cloud");
+ RNA_def_struct_path_func(srna, "rna_Point_path");
+
+ prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_float_funcs(prop, "rna_Point_location_get", "rna_Point_location_set", NULL);
+ RNA_def_property_ui_text(prop, "Location", "");
+ RNA_def_property_update(prop, 0, "rna_PointCloud_update_data");
+
+ prop = RNA_def_property(srna, "radius", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_funcs(prop, "rna_Point_radius_get", "rna_Point_radius_set", NULL);
+ RNA_def_property_ui_text(prop, "Radius", "");
+ RNA_def_property_update(prop, 0, "rna_PointCloud_update_data");
+
+ prop = RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_int_funcs(prop, "rna_Point_index_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Index", "Index of this points");
+}
+
+static void rna_def_pointcloud(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "PointCloud", "ID");
+ RNA_def_struct_ui_text(srna, "PointCloud", "Point cloud data-block");
+ RNA_def_struct_ui_icon(srna, ICON_POINTCLOUD_DATA);
+
+ /* geometry */
+ /* TODO: better solution for (*co)[3] parsing issue. */
+ RNA_define_verify_sdna(0);
+ prop = RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "co", "totpoint");
+ RNA_def_property_struct_type(prop, "Point");
+ RNA_def_property_ui_text(prop, "Points", "");
+ RNA_define_verify_sdna(1);
+
+ /* materials */
+ prop = RNA_def_property(srna, "materials", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol");
+ RNA_def_property_struct_type(prop, "Material");
+ RNA_def_property_ui_text(prop, "Materials", "");
+ RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.c */
+ RNA_def_property_collection_funcs(
+ prop, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "rna_IDMaterials_assign_int");
+
+ /* common */
+ rna_def_animdata_common(srna);
+}
+
+void RNA_def_pointcloud(BlenderRNA *brna)
+{
+ rna_def_point(brna);
+ rna_def_pointcloud(brna);
+}
+
+#endif
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index b4bb141ba7a..5d4ca44f53a 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -4230,6 +4230,13 @@ static void rna_def_space_view3d(BlenderRNA *brna)
{"Surface", (1 << OB_SURF), {"show_object_viewport_surf", "show_object_select_surf"}},
{"Meta", (1 << OB_MBALL), {"show_object_viewport_meta", "show_object_select_meta"}},
{"Font", (1 << OB_FONT), {"show_object_viewport_font", "show_object_select_font"}},
+# ifdef WITH_NEW_OBJECT_TYPES
+ {"Hair", (1 << OB_HAIR), {"show_object_viewport_hair", "show_object_select_hair"}},
+ {"Point Cloud",
+ (1 << OB_POINTCLOUD),
+ {"show_object_viewport_pointcloud", "show_object_select_pointcloud"}},
+# endif
+ {"Volume", (1 << OB_VOLUME), {"show_object_viewport_volume", "show_object_select_volume"}},
{"Armature",
(1 << OB_ARMATURE),
{"show_object_viewport_armature", "show_object_select_armature"}},
@@ -5432,8 +5439,16 @@ static void rna_def_fileselect_idfilter(BlenderRNA *brna)
"Grease Pencil",
"Show Grease pencil data-blocks"},
{FILTER_ID_GR, "filter_group", ICON_GROUP, "Collections", "Show Collection data-blocks"},
+# ifdef WITH_NEW_OBJECT_TYPES
+ {FILTER_ID_HA, "filter_hair", ICON_HAIR_DATA, "Hairs", "Show/hide Hair data-blocks"},
+# endif
{FILTER_ID_IM, "filter_image", ICON_IMAGE_DATA, "Images", "Show Image data-blocks"},
{FILTER_ID_LA, "filter_light", ICON_LIGHT_DATA, "Lights", "Show Light data-blocks"},
+ {FILTER_ID_LP,
+ "filter_light_probe",
+ ICON_OUTLINER_DATA_LIGHTPROBE,
+ "Light Probes",
+ "Show Light Probe data-blocks"},
{FILTER_ID_LS,
"filter_linestyle",
ICON_LINE_DATA,
@@ -5470,17 +5485,20 @@ static void rna_def_fileselect_idfilter(BlenderRNA *brna)
ICON_CURVE_BEZCURVE,
"Paint Curves",
"Show Paint Curve data-blocks"},
- {FILTER_ID_LP,
- "filter_light_probe",
- ICON_OUTLINER_DATA_LIGHTPROBE,
- "Light Probes",
- "Show Light Probe data-blocks"},
+# ifdef WITH_NEW_OBJECT_TYPES
+ {FILTER_ID_PT,
+ "filter_pointcloud",
+ ICON_POINTCLOUD_DATA,
+ "Point Clouds",
+ "Show/hide Point Cloud data-blocks"},
+# endif
{FILTER_ID_SCE, "filter_scene", ICON_SCENE_DATA, "Scenes", "Show Scene data-blocks"},
{FILTER_ID_SPK, "filter_speaker", ICON_SPEAKER, "Speakers", "Show Speaker data-blocks"},
{FILTER_ID_SO, "filter_sound", ICON_SOUND, "Sounds", "Show Sound data-blocks"},
{FILTER_ID_TE, "filter_texture", ICON_TEXTURE_DATA, "Textures", "Show Texture data-blocks"},
{FILTER_ID_TXT, "filter_text", ICON_TEXT, "Texts", "Show Text data-blocks"},
{FILTER_ID_VF, "filter_font", ICON_FONT_DATA, "Fonts", "Show Font data-blocks"},
+ {FILTER_ID_VO, "filter_volume", ICON_VOLUME_DATA, "Volumes", "Show/hide Volume data-blocks"},
{FILTER_ID_WO, "filter_world", ICON_WORLD_DATA, "Worlds", "Show World data-blocks"},
{FILTER_ID_WS,
"filter_work_space",
@@ -5495,8 +5513,9 @@ static void rna_def_fileselect_idfilter(BlenderRNA *brna)
"category_object",
ICON_GROUP,
"Objects & Collections",
- "Show objects and groups"},
- {FILTER_ID_AR | FILTER_ID_CU | FILTER_ID_LT | FILTER_ID_MB | FILTER_ID_ME,
+ "Show objects and collections"},
+ {FILTER_ID_AR | FILTER_ID_CU | FILTER_ID_LT | FILTER_ID_MB | FILTER_ID_ME | FILTER_ID_HA |
+ FILTER_ID_PT | FILTER_ID_VO,
"category_geometry",
ICON_MESH_DATA,
"Geometry",
@@ -5693,6 +5712,12 @@ static void rna_def_fileselect_params(BlenderRNA *brna)
RNA_def_property_ui_icon(prop, ICON_FILE_TEXT, 0);
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
+ prop = RNA_def_property(srna, "use_filter_volume", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "filter", FILE_TYPE_VOLUME);
+ RNA_def_property_ui_text(prop, "Filter Volume", "Show 3D volume files");
+ RNA_def_property_ui_icon(prop, ICON_FILE_VOLUME, 0);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
+
prop = RNA_def_property(srna, "use_filter_folder", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "filter", FILE_TYPE_FOLDER);
RNA_def_property_ui_text(prop, "Filter Folder", "Show folders");
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 195a80a1101..fdefbc9f499 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -4985,6 +4985,23 @@ static void rna_def_userdef_edit(BlenderRNA *brna)
RNA_def_property_ui_text(
prop, "Duplicate GPencil", "Causes grease pencil data to be duplicated with the object");
+# ifdef WITH_NEW_OBJECT_TYPES
+ prop = RNA_def_property(srna, "use_duplicate_hair", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "dupflag", USER_DUP_HAIR);
+ RNA_def_property_ui_text(
+ prop, "Duplicate Hair", "Causes hair data to be duplicated with the object");
+
+ prop = RNA_def_property(srna, "use_duplicate_pointcloud", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "dupflag", USER_DUP_POINTCLOUD);
+ RNA_def_property_ui_text(
+ prop, "Duplicate Point Cloud", "Causes point cloud data to be duplicated with the object");
+# endif
+
+ prop = RNA_def_property(srna, "use_duplicate_volume", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "dupflag", USER_DUP_VOLUME);
+ RNA_def_property_ui_text(
+ prop, "Duplicate Volume", "Causes volume data to be duplicated with the object");
+
/* Currently only used for insert offset (aka auto-offset),
* maybe also be useful for later stuff though. */
prop = RNA_def_property(srna, "node_margin", PROP_INT, PROP_PIXEL);
diff --git a/source/blender/makesrna/intern/rna_volume.c b/source/blender/makesrna/intern/rna_volume.c
new file mode 100644
index 00000000000..755d8922140
--- /dev/null
+++ b/source/blender/makesrna/intern/rna_volume.c
@@ -0,0 +1,557 @@
+/*
+ * ***** 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.
+ *
+ * Contributor(s): Jörg Müller.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/makesrna/intern/rna_volume.c
+ * \ingroup RNA
+ */
+
+#include <stdlib.h>
+
+#include "RNA_access.h"
+#include "RNA_define.h"
+#include "RNA_enum_types.h"
+
+#include "rna_internal.h"
+
+#include "DNA_scene_types.h"
+#include "DNA_volume_types.h"
+
+#include "BKE_volume.h"
+
+#include "BLI_math_base.h"
+
+#ifdef RNA_RUNTIME
+
+# include "DEG_depsgraph.h"
+# include "DEG_depsgraph_build.h"
+
+# include "WM_types.h"
+# include "WM_api.h"
+
+/* Updates */
+
+static void rna_Volume_update_display(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+{
+ Volume *volume = (Volume *)ptr->owner_id;
+ WM_main_add_notifier(NC_GEOM | ND_DATA, volume);
+}
+
+static void rna_Volume_update_filepath(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+{
+ Volume *volume = (Volume *)ptr->owner_id;
+ BKE_volume_unload(volume);
+ DEG_id_tag_update(&volume->id, ID_RECALC_COPY_ON_WRITE);
+ WM_main_add_notifier(NC_GEOM | ND_DATA, volume);
+}
+
+static void rna_Volume_update_is_sequence(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+ rna_Volume_update_filepath(bmain, scene, ptr);
+ DEG_relations_tag_update(bmain);
+}
+
+/* Grid */
+
+static void rna_VolumeGrid_name_get(PointerRNA *ptr, char *value)
+{
+ VolumeGrid *grid = ptr->data;
+ strcpy(value, BKE_volume_grid_name(grid));
+}
+
+static int rna_VolumeGrid_name_length(PointerRNA *ptr)
+{
+ VolumeGrid *grid = ptr->data;
+ return strlen(BKE_volume_grid_name(grid));
+}
+
+static int rna_VolumeGrid_data_type_get(PointerRNA *ptr)
+{
+ const VolumeGrid *grid = ptr->data;
+ return BKE_volume_grid_type(grid);
+}
+
+static int rna_VolumeGrid_channels_get(PointerRNA *ptr)
+{
+ const VolumeGrid *grid = ptr->data;
+ return BKE_volume_grid_channels(grid);
+}
+
+static void rna_VolumeGrid_matrix_object_get(PointerRNA *ptr, float *value)
+{
+ VolumeGrid *grid = ptr->data;
+ BKE_volume_grid_transform_matrix(grid, (float(*)[4])value);
+}
+
+static bool rna_VolumeGrid_is_loaded_get(PointerRNA *ptr)
+{
+ VolumeGrid *grid = ptr->data;
+ return BKE_volume_grid_is_loaded(grid);
+}
+
+static bool rna_VolumeGrid_load(ID *id, VolumeGrid *grid)
+{
+ return BKE_volume_grid_load((Volume *)id, grid);
+}
+
+static void rna_VolumeGrid_unload(ID *id, VolumeGrid *grid)
+{
+ BKE_volume_grid_unload((Volume *)id, grid);
+}
+
+/* Grids Iterator */
+
+static void rna_Volume_grids_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
+{
+ Volume *volume = ptr->data;
+ int num_grids = BKE_volume_num_grids(volume);
+ iter->internal.count.ptr = volume;
+ iter->internal.count.item = 0;
+ iter->valid = (iter->internal.count.item < num_grids);
+}
+
+static void rna_Volume_grids_next(CollectionPropertyIterator *iter)
+{
+ Volume *volume = iter->internal.count.ptr;
+ int num_grids = BKE_volume_num_grids(volume);
+ iter->internal.count.item++;
+ iter->valid = (iter->internal.count.item < num_grids);
+}
+
+static void rna_Volume_grids_end(CollectionPropertyIterator *UNUSED(iter))
+{
+}
+
+static PointerRNA rna_Volume_grids_get(CollectionPropertyIterator *iter)
+{
+ Volume *volume = iter->internal.count.ptr;
+ const VolumeGrid *grid = BKE_volume_grid_get(volume, iter->internal.count.item);
+ return rna_pointer_inherit_refine(&iter->parent, &RNA_VolumeGrid, (void *)grid);
+}
+
+static int rna_Volume_grids_length(PointerRNA *ptr)
+{
+ Volume *volume = ptr->data;
+ return BKE_volume_num_grids(volume);
+}
+
+/* Active Grid */
+
+static void rna_VolumeGrids_active_index_range(
+ PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
+{
+ Volume *volume = (Volume *)ptr->data;
+ int num_grids = BKE_volume_num_grids(volume);
+
+ *min = 0;
+ *max = max_ii(0, num_grids - 1);
+}
+
+static int rna_VolumeGrids_active_index_get(PointerRNA *ptr)
+{
+ Volume *volume = (Volume *)ptr->data;
+ int num_grids = BKE_volume_num_grids(volume);
+ return clamp_i(volume->active_grid, 0, max_ii(num_grids - 1, 0));
+}
+
+static void rna_VolumeGrids_active_index_set(PointerRNA *ptr, int value)
+{
+ Volume *volume = (Volume *)ptr->data;
+ volume->active_grid = value;
+}
+
+/* Loading */
+
+static bool rna_VolumeGrids_is_loaded_get(PointerRNA *ptr)
+{
+ Volume *volume = (Volume *)ptr->data;
+ return BKE_volume_is_loaded(volume);
+}
+
+/* Error Message */
+
+static void rna_VolumeGrids_error_message_get(PointerRNA *ptr, char *value)
+{
+ Volume *volume = (Volume *)ptr->data;
+ strcpy(value, BKE_volume_grids_error_msg(volume));
+}
+
+static int rna_VolumeGrids_error_message_length(PointerRNA *ptr)
+{
+ Volume *volume = (Volume *)ptr->data;
+ return strlen(BKE_volume_grids_error_msg(volume));
+}
+
+#else
+
+static void rna_def_volume_grid(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "VolumeGrid", NULL);
+ RNA_def_struct_ui_text(srna, "Volume Grid", "3D volume grid");
+ RNA_def_struct_ui_icon(srna, ICON_VOLUME_DATA);
+
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_string_funcs(
+ prop, "rna_VolumeGrid_name_get", "rna_VolumeGrid_name_length", NULL);
+ RNA_def_property_ui_text(prop, "Name", "Volume grid name");
+
+ static const EnumPropertyItem data_type_items[] = {
+ {VOLUME_GRID_BOOLEAN, "BOOLEAN", 0, "Boolean", "Boolean"},
+ {VOLUME_GRID_FLOAT, "FLOAT", 0, "Float", "Single precision float"},
+ {VOLUME_GRID_DOUBLE, "DOUBLE", 0, "Double", "Double precision"},
+ {VOLUME_GRID_INT, "INT", 0, "Integer", "32 bit integer"},
+ {VOLUME_GRID_INT64, "INT64", 0, "Integer 64 bit", "64 bit integer"},
+ {VOLUME_GRID_MASK, "MASK", 0, "Mask", "No data, boolean mask of active voxels"},
+ {VOLUME_GRID_STRING, "STRING", 0, "String", "Text string"},
+ {VOLUME_GRID_VECTOR_FLOAT, "VECTOR_FLOAT", 0, "Float Vector", "3D float vector"},
+ {VOLUME_GRID_VECTOR_DOUBLE, "VECTOR_DOUBLE", 0, "Double Vector", "3D double vector"},
+ {VOLUME_GRID_VECTOR_INT, "VECTOR_INT", 0, "Integer Vector", "3D integer vector"},
+ {VOLUME_GRID_POINTS,
+ "POINTS",
+ 0,
+ "Points (Unsupported)",
+ "Points grid, currently unsupported by volume objects"},
+ {VOLUME_GRID_UNKNOWN, "UNKNOWN", 0, "Unknown", "Unsupported data type"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ prop = RNA_def_property(srna, "data_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_enum_funcs(prop, "rna_VolumeGrid_data_type_get", NULL, NULL);
+ RNA_def_property_enum_items(prop, data_type_items);
+ RNA_def_property_ui_text(prop, "Data Type", "Data type of voxel values");
+
+ prop = RNA_def_property(srna, "channels", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_int_funcs(prop, "rna_VolumeGrid_channels_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Channels", "Number of dimensions of the grid data type");
+
+ prop = RNA_def_property(srna, "matrix_object", PROP_FLOAT, PROP_MATRIX);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
+ RNA_def_property_float_funcs(prop, "rna_VolumeGrid_matrix_object_get", NULL, NULL);
+ RNA_def_property_ui_text(
+ prop, "Matrix Object", "Transformation matrix from voxel index to object space");
+
+ prop = RNA_def_property(srna, "is_loaded", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_boolean_funcs(prop, "rna_VolumeGrid_is_loaded_get", NULL);
+ RNA_def_property_ui_text(prop, "Is Loaded", "Grid tree is loaded in memory");
+
+ /* API */
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ func = RNA_def_function(srna, "load", "rna_VolumeGrid_load");
+ RNA_def_function_ui_description(func, "Load grid tree from file");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID);
+ parm = RNA_def_boolean(func, "success", 0, "", "True if grid tree was successfully loaded");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "unload", "rna_VolumeGrid_unload");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID);
+ RNA_def_function_ui_description(
+ func, "Unload grid tree and voxel data from memory, leaving only metadata");
+}
+
+static void rna_def_volume_grids(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ RNA_def_property_srna(cprop, "VolumeGrids");
+ srna = RNA_def_struct(brna, "VolumeGrids", NULL);
+ RNA_def_struct_sdna(srna, "Volume");
+ RNA_def_struct_ui_text(srna, "Volume Grids", "3D volume grids");
+
+ prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_funcs(prop,
+ "rna_VolumeGrids_active_index_get",
+ "rna_VolumeGrids_active_index_set",
+ "rna_VolumeGrids_active_index_range");
+ RNA_def_property_ui_text(prop, "Active Grid Index", "Index of active volume grid");
+ RNA_def_property_update(prop, 0, "rna_Volume_update_display");
+
+ prop = RNA_def_property(srna, "error_message", PROP_STRING, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_string_funcs(
+ prop, "rna_VolumeGrids_error_message_get", "rna_VolumeGrids_error_message_length", NULL);
+ RNA_def_property_ui_text(
+ prop, "Error Message", "If loading grids failed, error message with details");
+
+ prop = RNA_def_property(srna, "is_loaded", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_boolean_funcs(prop, "rna_VolumeGrids_is_loaded_get", NULL);
+ RNA_def_property_ui_text(prop, "Is Loaded", "List of grids and metadata are loaded in memory");
+
+ prop = RNA_def_property(srna, "frame", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "runtime.frame");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop,
+ "Frame",
+ "Frame number that volume grids will be loaded at, based on scene time "
+ "and volume parameters");
+
+ /* API */
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ func = RNA_def_function(srna, "load", "BKE_volume_load");
+ RNA_def_function_ui_description(func, "Load list of grids and metadata from file");
+ RNA_def_function_flag(func, FUNC_USE_MAIN);
+ parm = RNA_def_boolean(func, "success", 0, "", "True if grid list was successfully loaded");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "unload", "BKE_volume_unload");
+ RNA_def_function_ui_description(func, "Unload all grid and voxel data from memory");
+}
+
+static void rna_def_volume_display(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "VolumeDisplay", NULL);
+ RNA_def_struct_ui_text(srna, "Volume Display", "Volume object display settings for 3d viewport");
+ RNA_def_struct_sdna(srna, "VolumeDisplay");
+
+ prop = RNA_def_property(srna, "density", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 0.00001, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.1, 100.0, 1, 3);
+ RNA_def_property_ui_text(prop, "Density", "Thickness of volume drawing in the viewport");
+ RNA_def_property_update(prop, 0, "rna_Volume_update_display");
+
+ static const EnumPropertyItem wireframe_type_items[] = {
+ {VOLUME_WIREFRAME_NONE, "NONE", 0, "None", "Don't display volume in wireframe mode"},
+ {VOLUME_WIREFRAME_BOUNDS,
+ "BOUNDS",
+ 0,
+ "Bounds",
+ "Display single bounding box for the entire grid"},
+ {VOLUME_WIREFRAME_BOXES,
+ "BOXES",
+ 0,
+ "Boxes",
+ "Display bounding boxes for nodes in the volume tree"},
+ {VOLUME_WIREFRAME_POINTS,
+ "POINTS",
+ 0,
+ "Points",
+ "Display points for nodes in the volume tree"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem wireframe_detail_items[] = {
+ {VOLUME_WIREFRAME_COARSE,
+ "COARSE",
+ 0,
+ "Coarse",
+ "Display one box or point for each intermediate tree node"},
+ {VOLUME_WIREFRAME_FINE,
+ "FINE",
+ 0,
+ "Fine",
+ "Display box for each leaf node containing 8x8 voxels"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ prop = RNA_def_property(srna, "wireframe_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, wireframe_type_items);
+ RNA_def_property_ui_text(prop, "Wireframe", "Type of wireframe display");
+ RNA_def_property_update(prop, 0, "rna_Volume_update_display");
+
+ prop = RNA_def_property(srna, "wireframe_detail", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, wireframe_detail_items);
+ RNA_def_property_ui_text(prop, "Wireframe Detail", "Amount of detail for wireframe display");
+ RNA_def_property_update(prop, 0, "rna_Volume_update_display");
+}
+
+static void rna_def_volume_render(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "VolumeRender", NULL);
+ RNA_def_struct_ui_text(srna, "Volume Render", "Volume object render settings");
+ RNA_def_struct_sdna(srna, "VolumeRender");
+
+ static const EnumPropertyItem space_items[] = {
+ {VOLUME_SPACE_OBJECT,
+ "OBJECT",
+ 0,
+ "Object",
+ "Keep volume opacity and detail the same regardless of object scale"},
+ {VOLUME_SPACE_WORLD,
+ "WORLD",
+ 0,
+ "World",
+ "Specify volume step size and density in world space"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ prop = RNA_def_property(srna, "space", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, space_items);
+ RNA_def_property_ui_text(
+ prop, "Space", "Specify volume density and step size in object or world space");
+ RNA_def_property_update(prop, 0, "rna_Volume_update_display");
+
+ prop = RNA_def_property(srna, "step_size", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 0.00001, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.001, 100.0, 1, 3);
+ RNA_def_property_ui_text(prop,
+ "Step Size",
+ "Distance between volume samples. Higher values render more detail at "
+ "the cost of performance. If set to zero, the step size is "
+ "automatically determined based on voxel size");
+ RNA_def_property_update(prop, 0, "rna_Volume_update_display");
+
+ prop = RNA_def_property(srna, "clipping", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "clipping");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_range(prop, 0.0, 1.0, 0.1, 3);
+ RNA_def_property_ui_text(
+ prop,
+ "Clipping",
+ "Value under which voxels are considered empty space to optimize rendering");
+ RNA_def_property_update(prop, 0, "rna_Volume_update_display");
+}
+
+static void rna_def_volume(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "Volume", "ID");
+ RNA_def_struct_ui_text(srna, "Volume", "Volume data-block for 3D volume grids");
+ RNA_def_struct_ui_icon(srna, ICON_VOLUME_DATA);
+
+ /* File */
+ prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "File Path", "Volume sample file used by this Volume data-block");
+ RNA_def_property_update(prop, 0, "rna_Volume_update_filepath");
+
+ prop = RNA_def_property(srna, "packed_file", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "packedfile");
+ RNA_def_property_ui_text(prop, "Packed File", "");
+
+ /* Sequence */
+ prop = RNA_def_property(srna, "is_sequence", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop, "Sequence", "Whether the cache is separated in a series of files");
+ RNA_def_property_update(prop, 0, "rna_Volume_update_is_sequence");
+
+ prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
+ RNA_def_property_ui_text(
+ prop, "Start Frame", "Global starting frame of the sequence, assuming first has a #1");
+ RNA_def_property_update(prop, 0, "rna_Volume_update_filepath");
+
+ prop = RNA_def_property(srna, "frame_duration", PROP_INT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 0, MAXFRAMEF);
+ RNA_def_property_ui_text(prop, "Frames", "Number of frames of the sequence to use");
+ RNA_def_property_update(prop, 0, "rna_Volume_update_filepath");
+
+ prop = RNA_def_property(srna, "frame_offset", PROP_INT, PROP_NONE);
+ RNA_def_property_ui_text(
+ prop, "Offset", "Offset the number of the frame to use in the animation");
+ RNA_def_property_update(prop, 0, "rna_Volume_update_filepath");
+
+ static const EnumPropertyItem sequence_mode_items[] = {
+ {VOLUME_SEQUENCE_CLIP, "CLIP", 0, "Clip", "Hide frames outside the specified frame range"},
+ {VOLUME_SEQUENCE_EXTEND,
+ "EXTEND",
+ 0,
+ "Extend",
+ "Repeat the start frame before, and the end frame after the frame range"},
+ {VOLUME_SEQUENCE_REPEAT, "REPEAT", 0, "Repeat", "Cycle the frames in the sequence"},
+ {VOLUME_SEQUENCE_PING_PONG,
+ "PING_PONG",
+ 0,
+ "Ping-Pong",
+ "Repeat the frames, reversing the playback direction every other cycle"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ prop = RNA_def_property(srna, "sequence_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_items(prop, sequence_mode_items);
+ RNA_def_property_ui_text(prop, "Sequence Mode", "Sequence playback mode");
+ RNA_def_property_update(prop, 0, "rna_Volume_update_filepath");
+
+ /* Grids */
+ prop = RNA_def_property(srna, "grids", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "VolumeGrid");
+ RNA_def_property_ui_text(prop, "Grids", "3D volume grids");
+ RNA_def_property_collection_funcs(prop,
+ "rna_Volume_grids_begin",
+ "rna_Volume_grids_next",
+ "rna_Volume_grids_end",
+ "rna_Volume_grids_get",
+ "rna_Volume_grids_length",
+ NULL,
+ NULL,
+ NULL);
+ rna_def_volume_grids(brna, prop);
+
+ /* Materials */
+ prop = RNA_def_property(srna, "materials", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol");
+ RNA_def_property_struct_type(prop, "Material");
+ RNA_def_property_ui_text(prop, "Materials", "");
+ RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.c */
+ RNA_def_property_collection_funcs(
+ prop, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "rna_IDMaterials_assign_int");
+
+ /* Display */
+ prop = RNA_def_property(srna, "display", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "display");
+ RNA_def_property_struct_type(prop, "VolumeDisplay");
+ RNA_def_property_ui_text(prop, "Display", "Volume display settings for 3d viewport");
+
+ /* Render */
+ prop = RNA_def_property(srna, "render", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "render");
+ RNA_def_property_struct_type(prop, "VolumeRender");
+ RNA_def_property_ui_text(prop, "Render", "Volume render settings for 3d viewport");
+
+ /* Common */
+ rna_def_animdata_common(srna);
+}
+
+void RNA_def_volume(BlenderRNA *brna)
+{
+ rna_def_volume_grid(brna);
+ rna_def_volume_display(brna);
+ rna_def_volume_render(brna);
+ rna_def_volume(brna);
+}
+
+#endif