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-16 08:19:22 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-09-16 08:19:22 +0400
commit36c273b1f7c65a759f77c8ed42b65b878dbb09da (patch)
tree8b75b606f4745c980c21790ff641b38fdb87d9ae /source/blender/blenkernel/intern/unit.c
parentd6baea457e51c1443d68eb4ca5393e7de9981c02 (diff)
- bone roll now in degrees not radians.
- rna buttons with units set now use the units base value for snapping. - bone head/tail radius could be set negative. matt: removed a check in ui_is_but_unit() which made angle buttons return false, what was this for?
Diffstat (limited to 'source/blender/blenkernel/intern/unit.c')
-rw-r--r--source/blender/blenkernel/intern/unit.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/unit.c b/source/blender/blenkernel/intern/unit.c
index 963cfdbea1b..36a4cfea7a0 100644
--- a/source/blender/blenkernel/intern/unit.c
+++ b/source/blender/blenkernel/intern/unit.c
@@ -24,6 +24,8 @@
#include <stdio.h>
#include <ctype.h>
#include <string.h>
+#include "BKE_unit.h"
+
#ifdef WIN32
#define _USE_MATH_DEFINES
#endif
@@ -31,6 +33,7 @@
#include "BLI_winstuff.h"
+
#define TEMP_STR_SIZE 256
#define SEP_CHR '#'
@@ -127,7 +130,8 @@ static struct bUnitDef buNaturalRotDef[] = {
};
static struct bUnitCollection buNaturalRotCollection = {buNaturalRotDef, 0, 0, sizeof(buNaturalRotDef)/sizeof(bUnitDef)};
-#define UNIT_SYSTEM_MAX 3
+#define UNIT_SYSTEM_TOT (((sizeof(bUnitSystems) / 8) / sizeof(void *)) - 1)
+
static struct bUnitCollection *bUnitSystems[][8] = {
{0,0,0,0,0,&buNaturalRotCollection,&buNaturalTimeCollecton,0},
{0,&buMetricLenCollecton, 0,0,0, &buNaturalRotCollection, &buNaturalTimeCollecton,0}, /* metric */
@@ -135,6 +139,8 @@ static struct bUnitCollection *bUnitSystems[][8] = {
{0,0,0,0,0,0,0,0}
};
+
+
/* internal, has some option not exposed */
static bUnitCollection *unit_get_system(int system, int type)
{
@@ -459,7 +465,7 @@ int bUnit_ReplaceString(char *str, int len_max, char *str_prev, double scale_pre
bUnitCollection *usys_iter;
int system_iter;
- for(system_iter= 0; system_iter<UNIT_SYSTEM_MAX; system_iter++) {
+ for(system_iter= 0; system_iter<UNIT_SYSTEM_TOT; system_iter++) {
if (system_iter != system) {
usys_iter= unit_get_system(system_iter, type);
if (usys_iter) {
@@ -610,6 +616,12 @@ double bUnit_BaseScalar(int system, int type)
}
/* external access */
+int bUnit_IsValid(int system, int type)
+{
+ return !(type < 0 || type >= B_UNIT_MAXDEF || system < 0 || system > UNIT_SYSTEM_TOT);
+}
+
+
void bUnit_GetSystem(void **usys_pt, int *len, int system, int type)
{
bUnitCollection *usys = unit_get_system(system, type);