Blender V2.61 - r43446
|
00001 /* 00002 * ***** BEGIN GPL LICENSE BLOCK ***** 00003 * 00004 * This program is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU General Public License 00006 * as published by the Free Software Foundation; either version 2 00007 * of the License, or (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software Foundation, 00016 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00017 * 00018 * Contributor(s): Campbell Barton 00019 * 00020 * ***** END GPL LICENSE BLOCK ***** 00021 */ 00022 00023 #ifndef BKE_UNIT_H 00024 #define BKE_UNIT_H 00025 00030 #ifdef __cplusplus 00031 extern "C" { 00032 #endif 00033 00034 /* in all cases the value is assumed to be scaled by the user preference */ 00035 00036 /* humanly readable representation of a value in units (used for button drawing) */ 00037 void bUnit_AsString(char *str, int len_max, double value, int prec, int system, int type, int split, int pad); 00038 00039 /* replace units with values, used before python button evaluation */ 00040 int bUnit_ReplaceString(char *str, int len_max, const char *str_prev, double scale_pref, int system, int type); 00041 00042 /* make string keyboard-friendly: 10µm --> 10um */ 00043 void bUnit_ToUnitAltName(char *str, int len_max, const char *orig_str, int system, int type); 00044 00045 /* the size of the unit used for this value (used for calculating the ckickstep) */ 00046 double bUnit_ClosestScalar(double value, int system, int type); 00047 00048 /* base scale for these units */ 00049 double bUnit_BaseScalar(int system, int type); 00050 00051 /* return true is the unit system exists */ 00052 int bUnit_IsValid(int system, int type); 00053 00054 /* loop over scales, coudl add names later */ 00055 //double bUnit_Iter(void **unit, char **name, int system, int type); 00056 00057 void bUnit_GetSystem(void **usys_pt, int *len, int system, int type); 00058 int bUnit_GetBaseUnit(void *usys_pt); 00059 const char* bUnit_GetName(void *usys_pt, int index); 00060 const char* bUnit_GetNameDisplay(void *usys_pt, int index); 00061 double bUnit_GetScaler(void *usys_pt, int index); 00062 00063 /* aligned with PropertyUnit */ 00064 #define B_UNIT_NONE 0 00065 #define B_UNIT_LENGTH 1 00066 #define B_UNIT_AREA 2 00067 #define B_UNIT_VOLUME 3 00068 #define B_UNIT_MASS 4 00069 #define B_UNIT_ROTATION 5 00070 #define B_UNIT_TIME 6 00071 #define B_UNIT_VELOCITY 7 00072 #define B_UNIT_ACCELERATION 8 00073 #define B_UNIT_TYPE_TOT 9 00074 00075 #ifdef __cplusplus 00076 } 00077 #endif 00078 00079 #endif /* BKE_UNIT_H */