formatting edits & remove debug print.
This commit is contained in:
		| @@ -254,7 +254,7 @@ static PyObject *BPy_IDGroup_Map_GetItem(BPy_IDProperty *self, PyObject *item) | ||||
|  | ||||
| 	idprop= IDP_GetPropertyFromGroup(self->prop, name); | ||||
|  | ||||
| 	if(idprop==NULL) { | ||||
| 	if (idprop==NULL) { | ||||
| 		PyErr_SetString(PyExc_KeyError, "key not in subgroup dict"); | ||||
| 		return NULL; | ||||
| 	} | ||||
| @@ -273,20 +273,20 @@ static int idp_sequence_type(PyObject *seq) | ||||
| 	for (i=0; i < len; i++) { | ||||
| 		item = PySequence_GetItem(seq, i); | ||||
| 		if (PyFloat_Check(item)) { | ||||
| 			if(type == IDP_IDPARRAY) { /* mixed dict/int */ | ||||
| 			if (type == IDP_IDPARRAY) { /* mixed dict/int */ | ||||
| 				Py_DECREF(item); | ||||
| 				return -1; | ||||
| 			} | ||||
| 			type= IDP_DOUBLE; | ||||
| 		} | ||||
| 		else if (PyLong_Check(item)) { | ||||
| 			if(type == IDP_IDPARRAY) { /* mixed dict/int */ | ||||
| 			if (type == IDP_IDPARRAY) { /* mixed dict/int */ | ||||
| 				Py_DECREF(item); | ||||
| 				return -1; | ||||
| 			} | ||||
| 		} | ||||
| 		else if (PyMapping_Check(item)) { | ||||
| 			if(i != 0 && (type != IDP_IDPARRAY)) { /* mixed dict/int */ | ||||
| 			if (i != 0 && (type != IDP_IDPARRAY)) { /* mixed dict/int */ | ||||
| 				Py_DECREF(item); | ||||
| 				return -1; | ||||
| 			} | ||||
| @@ -309,7 +309,7 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(const char *name, IDProperty *g | ||||
| 	IDProperty *prop = NULL; | ||||
| 	IDPropertyTemplate val = {0}; | ||||
|  | ||||
| 	if(strlen(name) >= sizeof(group->name)) | ||||
| 	if (strlen(name) >= sizeof(group->name)) | ||||
| 		return "the length of IDProperty names is limited to 31 characters"; | ||||
|  | ||||
| 	if (PyFloat_Check(ob)) { | ||||
| @@ -335,7 +335,7 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(const char *name, IDProperty *g | ||||
| 		PyObject *item; | ||||
| 		int i; | ||||
|  | ||||
| 		if((val.array.type= idp_sequence_type(ob)) == -1) | ||||
| 		if ((val.array.type= idp_sequence_type(ob)) == -1) | ||||
| 			return "only floats, ints and dicts are allowed in ID property arrays"; | ||||
|  | ||||
| 		/*validate sequence and derive type. | ||||
| @@ -369,7 +369,7 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(const char *name, IDProperty *g | ||||
| 				error= BPy_IDProperty_Map_ValidateAndCreate("", prop, item); | ||||
| 				Py_DECREF(item); | ||||
|  | ||||
| 				if(error) | ||||
| 				if (error) | ||||
| 					return error; | ||||
| 			} | ||||
| 			break; | ||||
| @@ -415,7 +415,7 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(const char *name, IDProperty *g | ||||
| 	} | ||||
| 	else return "invalid property value"; | ||||
|  | ||||
| 	if(group->type==IDP_IDPARRAY) { | ||||
| 	if (group->type==IDP_IDPARRAY) { | ||||
| 		IDP_AppendArray(group, prop); | ||||
| 		// IDP_FreeProperty(item); // IDP_AppendArray does a shallow copy (memcpy), only free memory | ||||
| 		MEM_freeN(prop); | ||||
| @@ -598,7 +598,7 @@ static PyObject *BPy_IDGroup_Pop(BPy_IDProperty *self, PyObject *value) | ||||
|  | ||||
| 	idprop= IDP_GetPropertyFromGroup(self->prop, name); | ||||
|  | ||||
| 	if(idprop) { | ||||
| 	if (idprop) { | ||||
| 		pyform = BPy_IDGroup_MapDataToPy(idprop); | ||||
|  | ||||
| 		if (!pyform) { | ||||
| @@ -1050,7 +1050,7 @@ static PyObject *BPy_IDArray_slice(BPy_IDArray *self, int begin, int end) | ||||
| 		case IDP_FLOAT: | ||||
| 		{ | ||||
| 			float *array= (float*)IDP_Array(prop); | ||||
| 			for(count = begin; count < end; count++) { | ||||
| 			for (count = begin; count < end; count++) { | ||||
| 				PyTuple_SET_ITEM(tuple, count - begin, PyFloat_FromDouble(array[count])); | ||||
| 			} | ||||
| 			break; | ||||
| @@ -1058,7 +1058,7 @@ static PyObject *BPy_IDArray_slice(BPy_IDArray *self, int begin, int end) | ||||
| 		case IDP_DOUBLE: | ||||
| 		{ | ||||
| 			double *array= (double*)IDP_Array(prop); | ||||
| 			for(count = begin; count < end; count++) { | ||||
| 			for (count = begin; count < end; count++) { | ||||
| 				PyTuple_SET_ITEM(tuple, count - begin, PyFloat_FromDouble(array[count])); | ||||
| 			} | ||||
| 			break; | ||||
| @@ -1066,7 +1066,7 @@ static PyObject *BPy_IDArray_slice(BPy_IDArray *self, int begin, int end) | ||||
| 		case IDP_INT: | ||||
| 		{ | ||||
| 			int *array= (int*)IDP_Array(prop); | ||||
| 			for(count = begin; count < end; count++) { | ||||
| 			for (count = begin; count < end; count++) { | ||||
| 				PyTuple_SET_ITEM(tuple, count - begin, PyLong_FromLong(array[count])); | ||||
| 			} | ||||
| 			break; | ||||
| @@ -1094,7 +1094,7 @@ static int BPy_IDArray_ass_slice(BPy_IDArray *self, int begin, int end, PyObject | ||||
| 	alloc_len= size * elem_size; | ||||
|  | ||||
| 	vec= MEM_mallocN(alloc_len, "array assignment"); /* NOTE: we count on int/float being the same size here */ | ||||
| 	if(PyC_AsArray(vec, seq, size, py_type, is_double, "slice assignment: ") == -1) { | ||||
| 	if (PyC_AsArray(vec, seq, size, py_type, is_double, "slice assignment: ") == -1) { | ||||
| 		MEM_freeN(vec); | ||||
| 		return -1; | ||||
| 	} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user