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:
authorSimon Lenz <Amudtogal>2022-01-12 20:02:08 +0300
committerJulian Eisel <julian@blender.org>2022-01-12 20:04:48 +0300
commitbab47b60cb69c500869a3339654ad7d48dddf385 (patch)
tree35405db4dd5cc5f3830ff13f9bf0c4b74d4bf003 /source/blender/makesdna
parenta909ab984ce4007c0dbd70ee085c1d4d780c4014 (diff)
DNA: Add space clip editor defaults
This is my attempt of adding defaults for the space clip editor struct (in line with https://developer.blender.org/T80164). It adds the default allocation for `SpaceClip` and `node_composite_movieclip.cc`. This also solves the error below (for C++ files using the DNA_default_alloc), which was put forward by Sergey Sharybin. Differential Revision: https://developer.blender.org/D13367 Reviewed by: Julian Eisel
Diffstat (limited to 'source/blender/makesdna')
-rw-r--r--source/blender/makesdna/DNA_defaults.h4
-rw-r--r--source/blender/makesdna/DNA_movieclip_defaults.h28
-rw-r--r--source/blender/makesdna/DNA_space_defaults.h67
-rw-r--r--source/blender/makesdna/intern/CMakeLists.txt1
-rw-r--r--source/blender/makesdna/intern/dna_defaults.c16
5 files changed, 115 insertions, 1 deletions
diff --git a/source/blender/makesdna/DNA_defaults.h b/source/blender/makesdna/DNA_defaults.h
index 6e986129143..ef7f573e7a8 100644
--- a/source/blender/makesdna/DNA_defaults.h
+++ b/source/blender/makesdna/DNA_defaults.h
@@ -48,7 +48,9 @@ uint8_t *_DNA_struct_default_alloc_impl(const uint8_t *data_src,
#define DNA_struct_default_alloc(struct_name) \
(struct_name *)_DNA_struct_default_alloc_impl( \
- DNA_default_table[SDNA_TYPE_FROM_STRUCT(struct_name)], sizeof(struct_name), __func__)
+ (const uint8_t *)DNA_default_table[SDNA_TYPE_FROM_STRUCT(struct_name)], \
+ sizeof(struct_name), \
+ __func__)
#ifdef __cplusplus
}
diff --git a/source/blender/makesdna/DNA_movieclip_defaults.h b/source/blender/makesdna/DNA_movieclip_defaults.h
index 753147eb072..e9013b08d79 100644
--- a/source/blender/makesdna/DNA_movieclip_defaults.h
+++ b/source/blender/makesdna/DNA_movieclip_defaults.h
@@ -45,6 +45,34 @@
.frame_offset = 0, \
}
+#define _DNA_DEFAULT_MovieClipUser \
+ { \
+ .framenr = 1, \
+ .render_size = MCLIP_PROXY_RENDER_SIZE_FULL, \
+ .render_flag = 0, \
+ }
+
+#define _DNA_DEFAULT_MovieClipScopes \
+ { \
+ .ok = 0, \
+ .use_track_mask = 0, \
+ .track_preview_height = 120, \
+ .frame_width = 0, \
+ .frame_height = 0, \
+ .undist_marker = _DNA_DEFAULT_MovieTrackingMarker, \
+ .track_pos = {0, 0}, \
+ .track_disabled = 0, \
+ .track_locked = 0, \
+ .scene_framenr = 0, \
+ .slide_scale = {0.0f, 0.0f}, \
+ }
+
+/* initialise as all zeros */
+#define _DNA_DEFAULT_MovieTrackingMarker \
+ { \
+ 0, \
+ }
+
/** \} */
/* clang-format on */
diff --git a/source/blender/makesdna/DNA_space_defaults.h b/source/blender/makesdna/DNA_space_defaults.h
new file mode 100644
index 00000000000..94577adc0d1
--- /dev/null
+++ b/source/blender/makesdna/DNA_space_defaults.h
@@ -0,0 +1,67 @@
+/*
+ * 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.
+ */
+
+/** \file
+ * \ingroup DNA
+ */
+
+#pragma once
+
+/* Struct members on own line. */
+/* clang-format off */
+
+/* -------------------------------------------------------------------- */
+/** \name Spaceclip Struct
+ * \{ */
+
+#define _DNA_DEFAULT_MaskSpaceInfo \
+ { \
+ .draw_flag = 0, \
+ .draw_type = MASK_DT_OUTLINE, \
+ .overlay_mode = MASK_OVERLAY_ALPHACHANNEL, \
+ }
+
+#define _DNA_DEFAULT_SpaceClip \
+ { \
+ .spacetype = SPACE_CLIP, \
+ .link_flag = 0, \
+ .xof = 0, \
+ .yof = 0, \
+ .xlockof = 0, \
+ .ylockof = 0, \
+ .zoom = 1.0f, \
+ .user = _DNA_DEFAULT_MovieClipUser, \
+ .scopes = _DNA_DEFAULT_MovieClipScopes, \
+ .flag = SC_SHOW_MARKER_PATTERN | SC_SHOW_TRACK_PATH | SC_SHOW_GRAPH_TRACKS_MOTION | \
+ SC_SHOW_GRAPH_FRAMES | SC_SHOW_ANNOTATION, \
+ .mode = SC_MODE_TRACKING, \
+ .view = SC_VIEW_CLIP, \
+ .path_length = 20, \
+ .loc = {0, 0}, \
+ .scale = 0, \
+ .angle = 0, \
+ .stabmat = _DNA_DEFAULT_UNIT_M4, \
+ .unistabmat = _DNA_DEFAULT_UNIT_M4, \
+ .postproc_flag = 0, \
+ .gpencil_src = SC_GPENCIL_SRC_CLIP, \
+ .around = V3D_AROUND_CENTER_MEDIAN, \
+ .cursor = {0, 0}, \
+ .mask_info = _DNA_DEFAULT_MaskSpaceInfo, \
+ }
+
+/** \} */
+
+/* clang-format on */
diff --git a/source/blender/makesdna/intern/CMakeLists.txt b/source/blender/makesdna/intern/CMakeLists.txt
index db34cf83fa9..a3c54e91780 100644
--- a/source/blender/makesdna/intern/CMakeLists.txt
+++ b/source/blender/makesdna/intern/CMakeLists.txt
@@ -159,6 +159,7 @@ set(SRC
../DNA_pointcloud_defaults.h
../DNA_scene_defaults.h
../DNA_simulation_defaults.h
+ ../DNA_space_defaults.h
../DNA_speaker_defaults.h
../DNA_texture_defaults.h
../DNA_vec_defaults.h
diff --git a/source/blender/makesdna/intern/dna_defaults.c b/source/blender/makesdna/intern/dna_defaults.c
index 1d4257328a4..cc060e1241c 100644
--- a/source/blender/makesdna/intern/dna_defaults.c
+++ b/source/blender/makesdna/intern/dna_defaults.c
@@ -103,6 +103,7 @@
#include "DNA_light_types.h"
#include "DNA_lightprobe_types.h"
#include "DNA_linestyle_types.h"
+#include "DNA_mask_types.h"
#include "DNA_material_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meta_types.h"
@@ -144,6 +145,7 @@
#include "DNA_pointcloud_defaults.h"
#include "DNA_scene_defaults.h"
#include "DNA_simulation_defaults.h"
+#include "DNA_space_defaults.h"
#include "DNA_speaker_defaults.h"
#include "DNA_texture_defaults.h"
#include "DNA_volume_defaults.h"
@@ -208,6 +210,9 @@ SDNA_DEFAULT_DECL_STRUCT(MetaBall);
/* DNA_movieclip_defaults.h */
SDNA_DEFAULT_DECL_STRUCT(MovieClip);
+SDNA_DEFAULT_DECL_STRUCT(MovieClipUser);
+SDNA_DEFAULT_DECL_STRUCT(MovieClipScopes);
+SDNA_DEFAULT_DECL_STRUCT(MovieTrackingMarker);
/* DNA_object_defaults.h */
SDNA_DEFAULT_DECL_STRUCT(Object);
@@ -225,6 +230,10 @@ SDNA_DEFAULT_DECL_STRUCT(ToolSettings);
/* DNA_simulation_defaults.h */
SDNA_DEFAULT_DECL_STRUCT(Simulation);
+/* DNA_space_defaults.h */
+SDNA_DEFAULT_DECL_STRUCT(MaskSpaceInfo);
+SDNA_DEFAULT_DECL_STRUCT(SpaceClip);
+
/* DNA_speaker_defaults.h */
SDNA_DEFAULT_DECL_STRUCT(Speaker);
@@ -406,11 +415,18 @@ const void *DNA_default_table[SDNA_TYPE_MAX] = {
/* DNA_mesh_defaults.h */
SDNA_DEFAULT_DECL(Mesh),
+ /* DNA_space_defaults.h */
+ SDNA_DEFAULT_DECL(SpaceClip),
+ SDNA_DEFAULT_DECL_EX(MaskSpaceInfo, SpaceClip.mask_info),
+ SDNA_DEFAULT_DECL_EX(MovieClipUser, SpaceClip.user),
+ SDNA_DEFAULT_DECL_EX(MovieClipScopes, SpaceClip.scopes),
+
/* DNA_meta_defaults.h */
SDNA_DEFAULT_DECL(MetaBall),
/* DNA_movieclip_defaults.h */
SDNA_DEFAULT_DECL(MovieClip),
+ SDNA_DEFAULT_DECL_EX(MovieTrackingMarker, MovieClipScopes.undist_marker),
/* DNA_object_defaults.h */
SDNA_DEFAULT_DECL(Object),