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:
authorCampbell Barton <ideasman42@gmail.com>2010-09-02 18:43:22 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-09-02 18:43:22 +0400
commit0d12c77097b19bfa688c99480f755184ad46342b (patch)
treea37bd154a82915c9b616fcbd855c6e4aeff16939 /source/blender
parent4e9162cd63badf4bf5fb312e108ffbbc58ebd342 (diff)
bugfix [#23635] property limits don't work when added via scripting\
also fix for bug where soft limits could be greater then hard limits with bpy.props.* functions.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/makesrna/intern/rna_rna.c12
-rw-r--r--source/blender/python/intern/bpy_props.c10
2 files changed, 18 insertions, 4 deletions
diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c
index 4bfd0e4fd41..81b0df1d840 100644
--- a/source/blender/makesrna/intern/rna_rna.c
+++ b/source/blender/makesrna/intern/rna_rna.c
@@ -493,6 +493,13 @@ static int rna_Property_registered_optional_get(PointerRNA *ptr)
return prop->flag & PROP_REGISTER_OPTIONAL;
}
+static int rna_Property_runtime_get(PointerRNA *ptr)
+{
+ PropertyRNA *prop= (PropertyRNA*)ptr->data;
+ return prop->flag & PROP_RUNTIME;
+}
+
+
static int rna_BoolProperty_default_get(PointerRNA *ptr)
{
PropertyRNA *prop= (PropertyRNA*)ptr->data;
@@ -1018,6 +1025,11 @@ static void rna_def_property(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_boolean_funcs(prop, "rna_Property_registered_optional_get", NULL);
RNA_def_property_ui_text(prop, "Registered Optionally", "Property is optionally registered as part of type registration");
+
+ prop= RNA_def_property(srna, "is_runtime", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_boolean_funcs(prop, "rna_Property_runtime_get", NULL);
+ RNA_def_property_ui_text(prop, "Read Only", "Property is editable through RNA");
}
static void rna_def_function(BlenderRNA *brna)
diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c
index 9535741f2b5..9ae7507a72a 100644
--- a/source/blender/python/intern/bpy_props.c
+++ b/source/blender/python/intern/bpy_props.c
@@ -26,6 +26,8 @@
#include "bpy_rna.h"
#include "bpy_util.h"
+#include "BKE_utildefines.h"
+
#include "RNA_define.h" /* for defining our own rna */
#include "RNA_enum_types.h"
@@ -294,7 +296,7 @@ PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw)
RNA_def_property_int_default(prop, def);
RNA_def_property_range(prop, min, max);
RNA_def_property_ui_text(prop, name, description);
- RNA_def_property_ui_range(prop, soft_min, soft_max, step, 3);
+ RNA_def_property_ui_range(prop, MAX2(soft_min, min), MIN2(soft_max, max), step, 3);
if(pyopts) {
if(opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN);
@@ -371,7 +373,7 @@ PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject *kw)
if(pydef) RNA_def_property_int_array_default(prop, def);
RNA_def_property_range(prop, min, max);
RNA_def_property_ui_text(prop, name, description);
- RNA_def_property_ui_range(prop, soft_min, soft_max, step, 3);
+ RNA_def_property_ui_range(prop, MAX2(soft_min, min), MIN2(soft_max, max), step, 3);
if(pyopts) {
if(opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN);
@@ -448,7 +450,7 @@ PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw)
RNA_def_property_float_default(prop, def);
RNA_def_property_range(prop, min, max);
RNA_def_property_ui_text(prop, name, description);
- RNA_def_property_ui_range(prop, soft_min, soft_max, step, precision);
+ RNA_def_property_ui_range(prop, MAX2(soft_min, min), MIN2(soft_max, max), step, precision);
if(pyopts) {
if(opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN);
@@ -525,7 +527,7 @@ PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObject *kw)
if(pydef) RNA_def_property_float_array_default(prop, def);
RNA_def_property_range(prop, min, max);
RNA_def_property_ui_text(prop, name, description);
- RNA_def_property_ui_range(prop, soft_min, soft_max, step, precision);
+ RNA_def_property_ui_range(prop, MAX2(soft_min, min), MIN2(soft_max, max), step, precision);
if(pyopts) {
if(opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN);