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/editors/space_clip
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/editors/space_clip')
-rw-r--r--source/blender/editors/space_clip/CMakeLists.txt3
-rw-r--r--source/blender/editors/space_clip/clip_editor.c9
-rw-r--r--source/blender/editors/space_clip/clip_ops.c3
-rw-r--r--source/blender/editors/space_clip/space_clip.c11
4 files changed, 13 insertions, 13 deletions
diff --git a/source/blender/editors/space_clip/CMakeLists.txt b/source/blender/editors/space_clip/CMakeLists.txt
index 8c7f59d61dd..06179ffdd95 100644
--- a/source/blender/editors/space_clip/CMakeLists.txt
+++ b/source/blender/editors/space_clip/CMakeLists.txt
@@ -31,6 +31,9 @@ set(INC
../../windowmanager
../../../../intern/glew-mx
../../../../intern/guardedalloc
+
+ # dna_type_offsets.h
+ ${CMAKE_CURRENT_BINARY_DIR}/../../makesdna/intern
)
set(SRC
diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c
index 09daed7e2e7..d22e4864ecf 100644
--- a/source/blender/editors/space_clip/clip_editor.c
+++ b/source/blender/editors/space_clip/clip_editor.c
@@ -34,6 +34,7 @@
#include "MEM_guardedalloc.h"
+#include "DNA_defaults.h"
#include "DNA_mask_types.h"
#include "BLI_fileops.h"
@@ -686,7 +687,7 @@ static bool check_prefetch_break(void)
static uchar *prefetch_read_file_to_memory(
MovieClip *clip, int current_frame, short render_size, short render_flag, size_t *r_size)
{
- MovieClipUser user = {0};
+ MovieClipUser user = *DNA_struct_default_get(MovieClipUser);
user.framenr = current_frame;
user.render_size = render_size;
user.render_flag = render_flag;
@@ -733,7 +734,7 @@ static int prefetch_find_uncached_frame(MovieClip *clip,
short direction)
{
int current_frame;
- MovieClipUser user = {0};
+ MovieClipUser user = *DNA_struct_default_get(MovieClipUser);
user.render_size = render_size;
user.render_flag = render_flag;
@@ -833,7 +834,7 @@ static void prefetch_task_func(TaskPool *__restrict pool, void *task_data)
while ((mem = prefetch_thread_next_frame(queue, clip, &size, &current_frame))) {
ImBuf *ibuf;
- MovieClipUser user = {0};
+ MovieClipUser user = *DNA_struct_default_get(MovieClipUser);
int flag = IB_rect | IB_multilayer | IB_alphamode_detect | IB_metadata;
int result;
char *colorspace_name = NULL;
@@ -915,7 +916,7 @@ static bool prefetch_movie_frame(MovieClip *clip,
short render_flag,
short *stop)
{
- MovieClipUser user = {0};
+ MovieClipUser user = *DNA_struct_default_get(MovieClipUser);
if (check_prefetch_break() || *stop) {
return false;
diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c
index 0aa7e35aed6..ef522e57d02 100644
--- a/source/blender/editors/space_clip/clip_ops.c
+++ b/source/blender/editors/space_clip/clip_ops.c
@@ -33,6 +33,7 @@
#include "MEM_guardedalloc.h"
+#include "DNA_defaults.h"
#include "DNA_scene_types.h" /* min/max frames */
#include "DNA_userdef_types.h"
@@ -1321,7 +1322,7 @@ static uchar *proxy_thread_next_frame(ProxyQueue *queue,
BLI_spin_lock(&queue->spin);
if (!*queue->stop && queue->cfra <= queue->efra) {
- MovieClipUser user = {0};
+ MovieClipUser user = *DNA_struct_default_get(MovieClipUser);
char name[FILE_MAX];
size_t size;
int file;
diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c
index 847cba32c69..b6dbda79a2d 100644
--- a/source/blender/editors/space_clip/space_clip.c
+++ b/source/blender/editors/space_clip/space_clip.c
@@ -24,6 +24,8 @@
#include <stdio.h>
#include <string.h>
+#include "DNA_defaults.h"
+
#include "DNA_mask_types.h"
#include "DNA_movieclip_types.h"
#include "DNA_scene_types.h"
@@ -239,14 +241,7 @@ static SpaceLink *clip_create(const ScrArea *area, const Scene *scene)
ARegion *region;
SpaceClip *sc;
- sc = MEM_callocN(sizeof(SpaceClip), "initclip");
- sc->spacetype = SPACE_CLIP;
- sc->flag = SC_SHOW_MARKER_PATTERN | SC_SHOW_TRACK_PATH | SC_SHOW_GRAPH_TRACKS_MOTION |
- SC_SHOW_GRAPH_FRAMES | SC_SHOW_ANNOTATION;
- sc->zoom = 1.0f;
- sc->path_length = 20;
- sc->scopes.track_preview_height = 120;
- sc->around = V3D_AROUND_CENTER_MEDIAN;
+ sc = DNA_struct_default_alloc(SpaceClip);
/* header */
region = MEM_callocN(sizeof(ARegion), "header for clip");