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:
authorJulian Eisel <julian@blender.org>2020-06-05 14:09:31 +0300
committerJulian Eisel <julian@blender.org>2020-06-05 14:09:31 +0300
commit920a58d9b6d667894cf166cbbd25e4c2fbd238ea (patch)
tree7ca5a9da640753b5e070c439ac3bdd14dfad92cf /source/blender/makesrna/intern/rna_access.c
parentc94b6209861ca7cc3985b53474feed7d94c0221a (diff)
parenta1d55bdd530390e58c51abe9707b8d3b0ae3e861 (diff)
Merge branch 'master' into wm-drag-drop-rewritewm-drag-drop-rewrite
Diffstat (limited to 'source/blender/makesrna/intern/rna_access.c')
-rw-r--r--source/blender/makesrna/intern/rna_access.c125
1 files changed, 7 insertions, 118 deletions
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index 48e4d758bba..2197764794b 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -40,7 +40,7 @@
#include "BLF_api.h"
#include "BLT_translation.h"
-#include "BKE_animsys.h"
+#include "BKE_anim_data.h"
#include "BKE_collection.h"
#include "BKE_context.h"
#include "BKE_fcurve.h"
@@ -98,8 +98,6 @@ void RNA_exit(void)
{
StructRNA *srna;
- RNA_property_update_cache_free();
-
for (srna = BLENDER_RNA.structs.first; srna; srna = srna->cont.next) {
if (srna->cont.prophash) {
BLI_ghash_free(srna->cont.prophash, NULL, NULL);
@@ -2184,7 +2182,7 @@ bool RNA_property_animated(PointerRNA *ptr, PropertyRNA *prop)
}
for (index = 0; index < len; index++) {
- if (rna_get_fcurve(ptr, prop, index, NULL, NULL, &driven, &special)) {
+ if (BKE_fcurve_find_by_rna(ptr, prop, index, NULL, NULL, &driven, &special)) {
return true;
}
}
@@ -2308,115 +2306,6 @@ void RNA_property_update_main(Main *bmain, Scene *scene, PointerRNA *ptr, Proper
rna_property_update(NULL, bmain, scene, ptr, prop);
}
-/* RNA Updates Cache ------------------------ */
-/* Overview of RNA Update cache system:
- *
- * RNA Update calls need to be cached in order to maintain reasonable performance
- * of the animation system (i.e. maintaining a somewhat interactive framerate)
- * while still allowing updates to be called (necessary in particular for modifier
- * property updates to actually work).
- *
- * The cache is structured with a dual-layer structure
- * - L1 = PointerRNA used as key; owner_id is used (it should always be defined,
- * and most updates end up using just that anyways)
- * - L2 = Update functions to be called on those PointerRNA's
- */
-
-/* cache element */
-typedef struct tRnaUpdateCacheElem {
- struct tRnaUpdateCacheElem *next, *prev;
-
- PointerRNA ptr; /* L1 key - id as primary, data secondary/ignored? */
- ListBase L2Funcs; /* L2 functions (LinkData<RnaUpdateFuncRef>) */
-} tRnaUpdateCacheElem;
-
-/* cache global (tRnaUpdateCacheElem's) - only accessible using these API calls */
-static ListBase rna_updates_cache = {NULL, NULL};
-
-/* ........................... */
-
-void RNA_property_update_cache_add(PointerRNA *ptr, PropertyRNA *prop)
-{
- const bool is_rna = (prop->magic == RNA_MAGIC);
- tRnaUpdateCacheElem *uce = NULL;
- UpdateFunc fn = NULL;
- LinkData *ld;
-
- /* sanity check */
- if (NULL == ptr) {
- return;
- }
-
- prop = rna_ensure_property(prop);
-
- /* we can only handle update calls with no context args for now (makes animsys updates easier) */
- if ((is_rna == false) || (prop->update == NULL) || (prop->flag & PROP_CONTEXT_UPDATE)) {
- return;
- }
- fn = prop->update;
-
- /* find cache element for which key matches... */
- for (uce = rna_updates_cache.first; uce; uce = uce->next) {
- /* Just match by id only for now,
- * since most update calls that we'll encounter only really care about this. */
- /* TODO: later, the cache might need to have some nesting on L1 to cope better
- * with these problems + some tagging to indicate we need this */
- if (uce->ptr.owner_id == ptr->owner_id) {
- break;
- }
- }
- if (uce == NULL) {
- /* create new instance */
- uce = MEM_callocN(sizeof(tRnaUpdateCacheElem), "tRnaUpdateCacheElem");
- BLI_addtail(&rna_updates_cache, uce);
-
- /* copy pointer */
- RNA_pointer_create(ptr->owner_id, ptr->type, ptr->data, &uce->ptr);
- }
-
- /* check on the update func */
- for (ld = uce->L2Funcs.first; ld; ld = ld->next) {
- /* stop on match - function already cached */
- if (fn == ld->data) {
- return;
- }
- }
- /* else... if still here, we need to add it */
- BLI_addtail(&uce->L2Funcs, BLI_genericNodeN(fn));
-}
-
-void RNA_property_update_cache_flush(Main *bmain, Scene *scene)
-{
- tRnaUpdateCacheElem *uce;
-
- /* TODO: should we check that bmain and scene are valid? The above stuff doesn't! */
-
- /* execute the cached updates */
- for (uce = rna_updates_cache.first; uce; uce = uce->next) {
- LinkData *ld;
-
- for (ld = uce->L2Funcs.first; ld; ld = ld->next) {
- UpdateFunc fn = (UpdateFunc)ld->data;
- fn(bmain, scene, &uce->ptr);
- }
- }
-}
-
-void RNA_property_update_cache_free(void)
-{
- tRnaUpdateCacheElem *uce, *ucn;
-
- for (uce = rna_updates_cache.first; uce; uce = ucn) {
- ucn = uce->next;
-
- /* free L2 cache */
- BLI_freelistN(&uce->L2Funcs);
-
- /* remove self */
- BLI_freelinkN(&rna_updates_cache, uce);
- }
-}
-
/* ---------------------------------------------------------------------- */
/* Property Data */
@@ -4497,8 +4386,8 @@ static int rna_raw_access(ReportList *reports,
/* check type */
itemtype = RNA_property_type(itemprop);
- if (!ELEM(itemtype, PROP_BOOLEAN, PROP_INT, PROP_FLOAT)) {
- BKE_report(reports, RPT_ERROR, "Only boolean, int and float properties supported");
+ if (!ELEM(itemtype, PROP_BOOLEAN, PROP_INT, PROP_FLOAT, PROP_ENUM)) {
+ BKE_report(reports, RPT_ERROR, "Only boolean, int float and enum properties supported");
return 0;
}
@@ -5785,10 +5674,10 @@ static char *rna_idp_path(PointerRNA *ptr,
}
/**
- * Find the path from the structure referenced by the pointer to the IDProperty object.
+ * Find the path from the structure referenced by the pointer to the #IDProperty object.
*
- * \param ptr Reference to the object owning the custom property storage.
- * \param needle Custom property object to find.
+ * \param ptr: Reference to the object owning the custom property storage.
+ * \param needle: Custom property object to find.
* \return Relative path or NULL.
*/
char *RNA_path_from_struct_to_idproperty(PointerRNA *ptr, IDProperty *needle)