Blender  V3.3
deg_builder_cache.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2018 Blender Foundation. All rights reserved. */
3 
8 #pragma once
9 
10 #include "MEM_guardedalloc.h"
11 
12 #include "intern/depsgraph_type.h"
13 
14 #include "RNA_access.h"
15 
16 struct ID;
17 struct PointerRNA;
18 struct PropertyRNA;
19 
20 namespace blender::deg {
21 
22 class DepsgraphBuilderCache;
23 
24 /* Identifier for animated property. */
26  public:
30  AnimatedPropertyID(const ID *id, StructRNA *type, const char *property_name);
31  AnimatedPropertyID(const ID *id, StructRNA *type, void *data, const char *property_name);
32 
33  uint64_t hash() const;
34  friend bool operator==(const AnimatedPropertyID &a, const AnimatedPropertyID &b);
35 
36  /* Corresponds to PointerRNA.data. */
37  const void *data;
39 
40  MEM_CXX_CLASS_ALLOC_FUNCS("AnimatedPropertyID");
41 };
42 
44  public:
46 
48 
49  void tagPropertyAsAnimated(const AnimatedPropertyID &property_id);
50  void tagPropertyAsAnimated(const PointerRNA *pointer_rna, const PropertyRNA *property_rna);
51 
52  bool isPropertyAnimated(const AnimatedPropertyID &property_id);
53  bool isPropertyAnimated(const PointerRNA *pointer_rna, const PropertyRNA *property_rna);
54 
56 
57  /* The storage is fully initialized from all F-Curves from corresponding ID. */
59 
60  /* indexed by PointerRNA.data. */
63 
64  MEM_CXX_CLASS_ALLOC_FUNCS("AnimatedPropertyStorage");
65 };
66 
67 /* Cached data which can be re-used by multiple builders. */
69  public:
71 
72  /* Makes sure storage for animated properties exists and initialized for the given ID. */
75 
76  /* Shortcuts to go through ensureInitializedAnimatedPropertyStorage and its
77  * isPropertyAnimated.
78  *
79  * NOTE: Avoid using for multiple subsequent lookups, query for the storage once, and then query
80  * the storage.
81  *
82  * TODO(sergey): Technically, this makes this class something else than just a cache, but what is
83  * the better name? */
84  template<typename... Args> bool isPropertyAnimated(const ID *id, Args... args)
85  {
87  id);
88  return animated_property_storage->isPropertyAnimated(args...);
89  }
90 
92  {
94  ptr->owner_id);
95  return animated_property_storage->isAnyPropertyAnimated(ptr);
96  }
97 
99 
100  MEM_CXX_CLASS_ALLOC_FUNCS("DepsgraphBuilderCache");
101 };
102 
103 } // namespace blender::deg
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
Read Guarded memory(de)allocation.
MEM_CXX_CLASS_ALLOC_FUNCS("AnimatedPropertyID")
friend bool operator==(const AnimatedPropertyID &a, const AnimatedPropertyID &b)
Set< AnimatedPropertyID > animated_properties_set
MEM_CXX_CLASS_ALLOC_FUNCS("AnimatedPropertyStorage")
void initializeFromID(DepsgraphBuilderCache *builder_cache, const ID *id)
bool isAnyPropertyAnimated(const PointerRNA *pointer_rna)
bool isPropertyAnimated(const AnimatedPropertyID &property_id)
void tagPropertyAsAnimated(const AnimatedPropertyID &property_id)
Map< const ID *, AnimatedPropertyStorage * > animated_property_storage_map_
bool isPropertyAnimated(const ID *id, Args... args)
bool isAnyPropertyAnimated(const PointerRNA *ptr)
AnimatedPropertyStorage * ensureInitializedAnimatedPropertyStorage(const ID *id)
MEM_CXX_CLASS_ALLOC_FUNCS("DepsgraphBuilderCache")
AnimatedPropertyStorage * ensureAnimatedPropertyStorage(const ID *id)
AnimatedPropertyStorage * animated_property_storage
DepsgraphBuilderCache * builder_cache
PointerRNA pointer_rna
static unsigned a[3]
Definition: RandGen.cpp:78
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
unsigned __int64 uint64_t
Definition: stdint.h:90
Definition: DNA_ID.h:368
struct ID * owner_id
Definition: RNA_types.h:36
PointerRNA * ptr
Definition: wm_files.c:3480