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:
authorJoshua Leung <aligorith@gmail.com>2011-01-12 01:32:18 +0300
committerJoshua Leung <aligorith@gmail.com>2011-01-12 01:32:18 +0300
commit144fb8ed1f43a83472270d4bdece36a2911188c1 (patch)
tree4f6099d8eacd6fe68ddb29cf02dd6cbd782214d9 /source/blender/makesrna
parent37b903e32c90562eeefcd1d3f93aa7f725a9729f (diff)
"Pointer" properties can now be reset to some kind of "default" value
when using the Numpad0 feature to reset properties to their default values. While this implementation here is not a full/proper implementation, as you cannot truly specify a default value for some pointers that may require something other than NULL (i.e. nothing), this should be good enough for the vast majority of (editable) cases which are fine if set to NULL. This is most noticeable with the Active Keying Set field in the TimeLine header, where it's now possible to simply use Numpad0 to clear it instead of using a confusing click+backspace+enter dance to do the same thing.
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r--source/blender/makesrna/RNA_access.h2
-rw-r--r--source/blender/makesrna/intern/rna_access.c16
2 files changed, 15 insertions, 3 deletions
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index b713668454e..91d5caf32a0 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -734,7 +734,7 @@ int RNA_property_enum_get_default(PointerRNA *ptr, PropertyRNA *prop);
PointerRNA RNA_property_pointer_get(PointerRNA *ptr, PropertyRNA *prop);
void RNA_property_pointer_set(PointerRNA *ptr, PropertyRNA *prop, PointerRNA ptr_value);
-// TODO: get default pointers...
+PointerRNA RNA_property_pointer_get_default(PointerRNA *ptr, PropertyRNA *prop);
void RNA_property_collection_begin(PointerRNA *ptr, PropertyRNA *prop, CollectionPropertyIterator *iter);
void RNA_property_collection_next(CollectionPropertyIterator *iter);
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index 7852a5488bd..742483663a6 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -2020,6 +2020,12 @@ void RNA_property_pointer_set(PointerRNA *ptr, PropertyRNA *prop, PointerRNA ptr
}
}
+PointerRNA RNA_property_pointer_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop))
+{
+ //PointerPropertyRNA *pprop= (PointerPropertyRNA*)prop;
+ return PointerRNA_NULL; // FIXME: there has to be a way...
+}
+
void RNA_property_pointer_add(PointerRNA *ptr, PropertyRNA *prop)
{
/*IDProperty *idprop;*/
@@ -4808,9 +4814,15 @@ int RNA_property_reset(PointerRNA *ptr, PropertyRNA *prop, int index)
return 1;
}
- //case PROP_POINTER:
+ case PROP_POINTER:
+ {
+ PointerRNA value= RNA_property_pointer_get_default(ptr, prop);
+ RNA_property_pointer_set(ptr, prop, value);
+ return 1;
+ }
+
default:
- // FIXME: many of the other types such as strings and pointers need this implemented too!
+ // FIXME: are there still any cases that haven't been handled? comment out "default" block to check :)
return 0;
}
}