Type checks for internal ID-Property UI min/max/tip & use defines to get values from ID-Props.
Probably wouldn't cause a problem but manually editing these types through python could easily crash blender. also changed cmake, stub-makefile default build dir to be lower case and leave out architecture string, easier for documentation. Use ../build/linux/ rather then ../build/Linux_i686/
This commit is contained in:
@@ -28,12 +28,13 @@
|
||||
|
||||
# System Vars
|
||||
OS:=$(shell uname -s)
|
||||
CPU:=$(shell uname -m)
|
||||
OS_NCASE:=$(shell uname -s | tr '[A-Z]' '[a-z]')
|
||||
# CPU:=$(shell uname -m) # UNUSED
|
||||
|
||||
|
||||
# Source and Build DIR's
|
||||
BLENDER_DIR:=$(shell pwd -P)
|
||||
BUILD_DIR:=$(shell dirname $(BLENDER_DIR))/build/$(OS)_$(CPU)
|
||||
BUILD_DIR:=$(shell dirname $(BLENDER_DIR))/build/$(OS_NCASE)
|
||||
|
||||
|
||||
# Get the number of cores for threaded build
|
||||
|
||||
@@ -127,6 +127,8 @@ int IDP_InsertToGroup(struct IDProperty *group, struct IDProperty *previous,
|
||||
void IDP_RemFromGroup(struct IDProperty *group, struct IDProperty *prop);
|
||||
|
||||
IDProperty *IDP_GetPropertyFromGroup(struct IDProperty *prop, const char *name);
|
||||
/* same as above but ensure type match */
|
||||
IDProperty *IDP_GetPropertyTypeFromGroup(struct IDProperty *prop, const char *name, const char type);
|
||||
|
||||
/*Get an iterator to iterate over the members of an id property group.
|
||||
Note that this will automatically free the iterator once iteration is complete;
|
||||
|
||||
@@ -535,6 +535,12 @@ IDProperty *IDP_GetPropertyFromGroup(IDProperty *prop, const char *name)
|
||||
return (IDProperty *)BLI_findstring(&prop->data.group, name, offsetof(IDProperty, name));
|
||||
}
|
||||
|
||||
IDProperty *IDP_GetPropertyTypeFromGroup(IDProperty *prop, const char *name, const char type)
|
||||
{
|
||||
IDProperty *idprop= IDP_GetPropertyFromGroup(prop, name);
|
||||
return (idprop && idprop->type == type) ? idprop : NULL;
|
||||
}
|
||||
|
||||
typedef struct IDPIter {
|
||||
void *next;
|
||||
IDProperty *parent;
|
||||
|
||||
@@ -5452,10 +5452,10 @@ static int texture_paint_camera_project_exec(bContext *C, wmOperator *op)
|
||||
idgroup= IDP_GetProperties(&image->id, 0);
|
||||
|
||||
if(idgroup) {
|
||||
view_data= IDP_GetPropertyFromGroup(idgroup, PROJ_VIEW_DATA_ID);
|
||||
view_data= IDP_GetPropertyTypeFromGroup(idgroup, PROJ_VIEW_DATA_ID, IDP_ARRAY);
|
||||
|
||||
/* type check to make sure its ok */
|
||||
if(view_data->len != PROJ_VIEW_DATA_SIZE || view_data->type != IDP_ARRAY || view_data->subtype != IDP_FLOAT) {
|
||||
if(view_data->len != PROJ_VIEW_DATA_SIZE || view_data->subtype != IDP_FLOAT) {
|
||||
BKE_report(op->reports, RPT_ERROR, "Image project data invalid.");
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
@@ -235,8 +235,9 @@ IDProperty *rna_idproperty_ui(PropertyRNA *prop)
|
||||
}
|
||||
}
|
||||
|
||||
if (idprop)
|
||||
return IDP_GetPropertyFromGroup(idprop, ((IDProperty *)prop)->name);
|
||||
if (idprop) {
|
||||
return IDP_GetPropertyTypeFromGroup(idprop, ((IDProperty *)prop)->name, IDP_GROUP);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -447,11 +448,10 @@ static const char *rna_ensure_property_description(PropertyRNA *prop)
|
||||
/* attempt to get the local ID values */
|
||||
IDProperty *idp_ui= rna_idproperty_ui(prop);
|
||||
|
||||
if(idp_ui) { /* TODO, type checking on ID props */
|
||||
|
||||
IDProperty *item= IDP_GetPropertyFromGroup(idp_ui, "description");
|
||||
if(idp_ui) {
|
||||
IDProperty *item= IDP_GetPropertyTypeFromGroup(idp_ui, "description", IDP_STRING);
|
||||
if(item)
|
||||
return (char *)item->data.pointer ;
|
||||
return IDP_String(item);
|
||||
}
|
||||
|
||||
return ((IDProperty*)prop)->name; /* XXX - not correct */
|
||||
@@ -803,14 +803,15 @@ void RNA_property_int_range(PointerRNA *ptr, PropertyRNA *prop, int *hardmin, in
|
||||
if(prop->magic != RNA_MAGIC) {
|
||||
/* attempt to get the local ID values */
|
||||
IDProperty *idp_ui= rna_idproperty_ui(prop);
|
||||
IDProperty *item;
|
||||
|
||||
if(idp_ui) { /* TODO, type checking on ID props */
|
||||
item= IDP_GetPropertyFromGroup(idp_ui, "min");
|
||||
*hardmin= item ? item->data.val : INT_MIN;
|
||||
if(idp_ui) {
|
||||
IDProperty *item;
|
||||
|
||||
item= IDP_GetPropertyFromGroup(idp_ui, "max");
|
||||
*hardmax= item ? item->data.val : INT_MAX;
|
||||
item= IDP_GetPropertyTypeFromGroup(idp_ui, "min", IDP_INT);
|
||||
*hardmin= item ? IDP_Int(item) : INT_MIN;
|
||||
|
||||
item= IDP_GetPropertyTypeFromGroup(idp_ui, "max", IDP_INT);
|
||||
*hardmax= item ? IDP_Int(item) : INT_MAX;
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -833,17 +834,18 @@ void RNA_property_int_ui_range(PointerRNA *ptr, PropertyRNA *prop, int *softmin,
|
||||
if(prop->magic != RNA_MAGIC) {
|
||||
/* attempt to get the local ID values */
|
||||
IDProperty *idp_ui= rna_idproperty_ui(prop);
|
||||
IDProperty *item;
|
||||
|
||||
if(idp_ui) { /* TODO, type checking on ID props */
|
||||
item= IDP_GetPropertyFromGroup(idp_ui, "soft_min");
|
||||
*softmin= item ? item->data.val : INT_MIN;
|
||||
if(idp_ui) {
|
||||
IDProperty *item;
|
||||
|
||||
item= IDP_GetPropertyFromGroup(idp_ui, "soft_max");
|
||||
*softmax= item ? item->data.val : INT_MAX;
|
||||
item= IDP_GetPropertyTypeFromGroup(idp_ui, "soft_min", IDP_INT);
|
||||
*softmin= item ? IDP_Int(item) : INT_MIN;
|
||||
|
||||
item= IDP_GetPropertyFromGroup(idp_ui, "step");
|
||||
*step= item ? item->data.val : 1;
|
||||
item= IDP_GetPropertyTypeFromGroup(idp_ui, "soft_max", IDP_INT);
|
||||
*softmax= item ? IDP_Int(item) : INT_MAX;
|
||||
|
||||
item= IDP_GetPropertyTypeFromGroup(idp_ui, "step", IDP_INT);
|
||||
*step= item ? IDP_Int(item) : 1;
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -869,14 +871,15 @@ void RNA_property_float_range(PointerRNA *ptr, PropertyRNA *prop, float *hardmin
|
||||
if(prop->magic != RNA_MAGIC) {
|
||||
/* attempt to get the local ID values */
|
||||
IDProperty *idp_ui= rna_idproperty_ui(prop);
|
||||
IDProperty *item;
|
||||
|
||||
if(idp_ui) { /* TODO, type checking on ID props */
|
||||
item= IDP_GetPropertyFromGroup(idp_ui, "min");
|
||||
*hardmin= item ? *(double*)&item->data.val : FLT_MIN;
|
||||
if(idp_ui) {
|
||||
IDProperty *item;
|
||||
|
||||
item= IDP_GetPropertyFromGroup(idp_ui, "max");
|
||||
*hardmax= item ? *(double*)&item->data.val : FLT_MAX;
|
||||
item= IDP_GetPropertyTypeFromGroup(idp_ui, "min", IDP_DOUBLE);
|
||||
*hardmin= item ? IDP_Double(item) : FLT_MIN;
|
||||
|
||||
item= IDP_GetPropertyTypeFromGroup(idp_ui, "max", IDP_DOUBLE);
|
||||
*hardmax= item ? IDP_Double(item) : FLT_MAX;
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -899,20 +902,21 @@ void RNA_property_float_ui_range(PointerRNA *ptr, PropertyRNA *prop, float *soft
|
||||
if(prop->magic != RNA_MAGIC) {
|
||||
/* attempt to get the local ID values */
|
||||
IDProperty *idp_ui= rna_idproperty_ui(prop);
|
||||
IDProperty *item;
|
||||
|
||||
if(idp_ui) { /* TODO, type checking on ID props */
|
||||
item= IDP_GetPropertyFromGroup(idp_ui, "soft_min");
|
||||
*softmin= item ? *(double*)&item->data.val : FLT_MIN;
|
||||
if(idp_ui) {
|
||||
IDProperty *item;
|
||||
|
||||
item= IDP_GetPropertyFromGroup(idp_ui, "soft_max");
|
||||
*softmax= item ? *(double*)&item->data.val : FLT_MAX;
|
||||
item= IDP_GetPropertyTypeFromGroup(idp_ui, "soft_min", IDP_DOUBLE);
|
||||
*softmin= item ? IDP_Double(item) : FLT_MIN;
|
||||
|
||||
item= IDP_GetPropertyFromGroup(idp_ui, "step");
|
||||
*step= item ? *(double*)&item->data.val : 1.0f;
|
||||
item= IDP_GetPropertyTypeFromGroup(idp_ui, "soft_max", IDP_DOUBLE);
|
||||
*softmax= item ? IDP_Double(item) : FLT_MAX;
|
||||
|
||||
item= IDP_GetPropertyFromGroup(idp_ui, "precision");
|
||||
*precision= item ? *(double*)&item->data.val : 3.0f;
|
||||
item= IDP_GetPropertyTypeFromGroup(idp_ui, "step", IDP_DOUBLE);
|
||||
*step= item ? IDP_Double(item) : 1.0f;
|
||||
|
||||
item= IDP_GetPropertyTypeFromGroup(idp_ui, "precision", IDP_DOUBLE);
|
||||
*precision= item ? IDP_Double(item) : 3.0f;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user