- moved unit settings from user prefs into the scene.

- use the scene context for the unit settings since there isn't a better place for it currently.
- added 'chain' to imperial units
- set more rna props to be distances and angles.
This commit is contained in:
2009-08-13 07:37:41 +00:00
parent 127f19cac4
commit d916c25616
13 changed files with 149 additions and 103 deletions

View File

@@ -428,6 +428,25 @@ class SCENE_PT_stamp(RenderButtonsPanel):
sub.active = rd.stamp_note
sub.itemR(rd, "stamp_note_text", text="")
class SCENE_PT_unit(RenderButtonsPanel):
__label__ = "Units"
__default_closed__ = True
COMPAT_ENGINES = set(['BLENDER_RENDER'])
def draw(self, context):
layout = self.layout
unit = context.scene.unit_settings
col = layout.column()
col.itemR(unit, "system")
col = layout.column()
col.active = (unit.system != 'NONE')
col.itemR(unit, "scale_length")
col.itemR(unit, "use_separate")
bpy.types.register(SCENE_PT_render)
bpy.types.register(SCENE_PT_layers)
bpy.types.register(SCENE_PT_dimensions)
@@ -438,3 +457,4 @@ bpy.types.register(SCENE_PT_encoding)
bpy.types.register(SCENE_PT_performance)
bpy.types.register(SCENE_PT_post_processing)
bpy.types.register(SCENE_PT_stamp)
bpy.types.register(SCENE_PT_unit)

View File

@@ -320,17 +320,6 @@ class INFO_PT_edit(bpy.types.Panel):
sub1.itemS()
sub1.itemL(text="Transform:")
sub1.itemR(edit, "drag_immediately")
sub1.itemS()
sub1.itemS()
sub1.itemS()
sub1.itemL(text="Units:")
sub1.itemR(edit, "unit_system")
sub2 = sub1.column()
sub2.active = (edit.unit_system != 'NONE')
sub2.itemR(edit, "unit_scale_length")
sub2.itemR(edit, "use_unit_split")
col = split.column()
sub = col.split(percentage=0.85)

View File

@@ -280,6 +280,9 @@ Scene *add_scene(char *name)
sce->toolsettings->proportional_size = 1.0f;
sce->unit.scale_length = 1.0f;
pset= &sce->toolsettings->particle;
pset->flag= PE_KEEP_LENGTHS|PE_LOCK_FIRST|PE_DEFLECT_EMITTER;
pset->emitterdist= 0.25f;

View File

@@ -82,6 +82,7 @@ static struct bUnitCollection buMetricLenCollecton = {buMetricLenDef, 3, 0, size
static struct bUnitDef buImperialLenDef[] = {
{"mile", "Miles", "mi", "m", 1609.344, 0.0, B_UNIT_DEF_NONE},
{"furlong", "Furlongs", "fur", NULL,201.168, 0.0, B_UNIT_DEF_SUPPRESS},
{"chain", "Chains", "ch", NULL, 0.9144*22.0, 0.0, B_UNIT_DEF_SUPPRESS},
{"yard", "Yards", "yd", NULL, 0.9144, 0.0, B_UNIT_DEF_NONE},
{"foot", "Feet", "'", "ft", 0.3048, 0.0, B_UNIT_DEF_NONE},
{"inch", "Inches", "\"", "in", 0.0254, 0.0, B_UNIT_DEF_NONE}, /* base unit */

View File

@@ -1144,7 +1144,8 @@ int ui_is_but_float(uiBut *but)
int ui_is_but_unit(uiBut *but)
{
if(U.unit_system == USER_UNIT_NONE)
Scene *scene= CTX_data_scene((bContext *)but->block->evil_C);
if(scene->unit.system == USER_UNIT_NONE)
return 0;
if(but->rnaprop==NULL)
@@ -1324,13 +1325,13 @@ int ui_get_but_string_max_length(uiBut *but)
static double ui_get_but_scale_unit(uiBut *but, double value)
{
Scene *scene= CTX_data_scene((bContext *)but->block->evil_C);
int subtype= RNA_property_subtype(but->rnaprop);
if(subtype & PROP_UNIT_LENGTH) {
return value * U.unit_scale_length;
return value * scene->unit.scale_length;
}
else if(subtype & PROP_UNIT_TIME) { /* WARNING - using evil_C :| */
Scene *scene= CTX_data_scene((bContext *)but->block->evil_C);
return FRA2TIME(value);
}
else {
@@ -1340,23 +1341,27 @@ static double ui_get_but_scale_unit(uiBut *but, double value)
static void ui_get_but_string_unit(uiBut *but, char *str, double value, int pad)
{
int do_split= U.unit_flag & USER_UNIT_OPT_SPLIT ? 1:0;
Scene *scene= CTX_data_scene((bContext *)but->block->evil_C);
int do_split= scene->unit.flag & USER_UNIT_OPT_SPLIT;
int unit_type= RNA_SUBTYPE_UNIT_VALUE(RNA_property_subtype(but->rnaprop));
int precission= but->a2;
if(scene->unit.scale_length<0.0001) scene->unit.scale_length= 1.0; // XXX do_versions
/* Sanity checks */
if(precission>4) precission= 4;
else if(precission==0) precission= 2;
bUnit_AsString(str, ui_get_but_scale_unit(but, value), precission, U.unit_system, unit_type, do_split, pad);
bUnit_AsString(str, ui_get_but_scale_unit(but, value), precission, scene->unit.system, unit_type, do_split, pad);
}
static float ui_get_but_step_unit(uiBut *but, double value, float step_default)
{
Scene *scene= CTX_data_scene((bContext *)but->block->evil_C);
int unit_type= RNA_SUBTYPE_UNIT_VALUE(RNA_property_subtype(but->rnaprop));
float step;
step = bUnit_ClosestScalar(ui_get_but_scale_unit(but, value), U.unit_system, unit_type);
step = bUnit_ClosestScalar(ui_get_but_scale_unit(but, value), scene->unit.system, unit_type);
if(step > 0.0) { /* -1 is an error value */
return (step/ui_get_but_scale_unit(but, 1.0))*100;
@@ -1502,10 +1507,12 @@ int ui_set_but_string(bContext *C, uiBut *but, const char *str)
{
char str_unit_convert[256];
int unit_type= RNA_SUBTYPE_UNIT_VALUE(RNA_property_subtype(but->rnaprop));
Scene *scene= CTX_data_scene((bContext *)but->block->evil_C);
if(U.unit_system != USER_UNIT_NONE && unit_type) {
if(scene->unit.system != USER_UNIT_NONE && unit_type) {
/* ugly, use the draw string to get the value, this could cause problems if it includes some text which resolves to a unit */
bUnit_ReplaceString(str_unit_convert, str, but->drawstr, ui_get_but_scale_unit(but, 1.0), U.unit_system, unit_type);
bUnit_ReplaceString(str_unit_convert, str, but->drawstr, ui_get_but_scale_unit(but, 1.0), scene->unit.system, unit_type);
}
else {
strcpy(str_unit_convert, str);
@@ -1865,9 +1872,6 @@ void ui_check_but(uiBut *but)
/* support length type buttons */
else if(ui_is_but_unit(but)) {
char new_str[256];
if(U.unit_scale_length<0.0001) U.unit_scale_length= 1.0; // XXX do_versions
ui_get_but_string_unit(but, new_str, value, TRUE);
sprintf(but->drawstr, "%s%s", but->str, new_str);
}

View File

@@ -237,7 +237,7 @@ static void drawgrid_draw(ARegion *ar, float wx, float wy, float x, float y, flo
#define GRID_MIN_PX 6.0f
static void drawgrid(ARegion *ar, View3D *v3d, char **grid_unit)
static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, char **grid_unit)
{
/* extern short bgpicmode; */
RegionView3D *rv3d= ar->regiondata;
@@ -260,7 +260,7 @@ static void drawgrid(ARegion *ar, View3D *v3d, char **grid_unit)
x= (wx)*fx/fw;
y= (wy)*fy/fw;
vec4[0]=vec4[1]= (U.unit_system) ? 1.0 : v3d->grid;
vec4[0]=vec4[1]= (unit->system) ? 1.0 : v3d->grid;
vec4[2]= 0.0;
vec4[3]= 1.0;
@@ -277,7 +277,7 @@ static void drawgrid(ARegion *ar, View3D *v3d, char **grid_unit)
/* check zoom out */
UI_ThemeColor(TH_GRID);
if(U.unit_system) {
if(unit->system) {
/* Use GRID_MIN_PX*2 for units because very very small grid
* items are less useful when dealing with units */
void *usys;
@@ -286,21 +286,21 @@ static void drawgrid(ARegion *ar, View3D *v3d, char **grid_unit)
float dx_scalar;
float blend_fac;
bUnit_GetSystem(&usys, &len, U.unit_system, B_UNIT_LENGTH);
bUnit_GetSystem(&usys, &len, unit->system, B_UNIT_LENGTH);
if(usys) {
i= len;
while(i--) {
scalar= bUnit_GetScaler(usys, i);
dx_scalar = dx * scalar * U.unit_scale_length;
dx_scalar = dx * scalar * unit->scale_length;
if (dx_scalar < (GRID_MIN_PX*2))
continue;
/* Store the smallest drawn grid size units name so users know how big each grid cell is */
if(*grid_unit==NULL) {
*grid_unit= bUnit_GetNamePlural(usys, i);
v3d->gridview= (scalar * U.unit_scale_length);
v3d->gridview= (scalar * unit->scale_length);
}
blend_fac= 1-((GRID_MIN_PX*2)/dx_scalar);
@@ -1978,7 +1978,7 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
}
else {
ED_region_pixelspace(ar);
drawgrid(ar, v3d, &grid_unit);
drawgrid(&scene->unit, ar, v3d, &grid_unit);
/* XXX make function? replaces persp(1) */
glMatrixMode(GL_PROJECTION);
wmLoadMatrix(rv3d->winmat);

View File

@@ -3040,11 +3040,11 @@ static void headerTranslation(TransInfo *t, float vec[3], char *str) {
applyAspectRatio(t, dvec);
dist = VecLength(vec);
if(U.unit_system) {
int i, do_split= U.unit_flag & USER_UNIT_OPT_SPLIT ? 1:0;
if(t->scene->unit.system) {
int i, do_split= t->scene->unit.flag & USER_UNIT_OPT_SPLIT ? 1:0;
for(i=0; i<3; i++)
bUnit_AsString(&tvec[i*20], dvec[i]*U.unit_scale_length, 4, U.unit_system, B_UNIT_LENGTH, do_split, 1);
bUnit_AsString(&tvec[i*20], dvec[i]*t->scene->unit.scale_length, 4, t->scene->unit.system, B_UNIT_LENGTH, do_split, 1);
}
else {
sprintf(&tvec[0], "%.4f", dvec[0]);
@@ -3053,8 +3053,8 @@ static void headerTranslation(TransInfo *t, float vec[3], char *str) {
}
}
if(U.unit_system)
bUnit_AsString(distvec, dist*U.unit_scale_length, 4, U.unit_system, B_UNIT_LENGTH, U.unit_flag & USER_UNIT_OPT_SPLIT, 0);
if(t->scene->unit.system)
bUnit_AsString(distvec, dist*t->scene->unit.scale_length, 4, t->scene->unit.system, B_UNIT_LENGTH, t->scene->unit.flag & USER_UNIT_OPT_SPLIT, 0);
else if( dist > 1e10 || dist < -1e10 ) /* prevent string buffer overflow */
sprintf(distvec, "%.4e", dist);
else

View File

@@ -622,6 +622,12 @@ typedef struct bStats {
int totvert, totface;
} bStats;
typedef struct UnitSettings {
/* Display/Editing unit options for each scene */
float scale_length; /* maybe have other unit conversions? */
short system;
short flag; /* imperial, metric etc */
} UnitSettings;
typedef struct Scene {
ID id;
@@ -681,6 +687,10 @@ typedef struct Scene {
/* Game Settings */
struct GameFraming framing; // XXX deprecated since 2.5
struct GameData gm;
/* Units */
struct UnitSettings unit;
} Scene;
@@ -1072,6 +1082,15 @@ typedef enum SculptFlags {
#define SK_RETARGET_ROLL_VIEW 1
#define SK_RETARGET_ROLL_JOINT 2
/* UnitSettings */
/* UnitSettings->system */
#define USER_UNIT_NONE 0
#define USER_UNIT_METRIC 1
#define USER_UNIT_IMPERIAL 2
/* UnitSettings->flag */
#define USER_UNIT_OPT_SPLIT 1
#ifdef __cplusplus
}

View File

@@ -299,9 +299,7 @@ typedef struct UserDef {
int audiochannels;
int scrollback; /* console scrollback limit */
float unit_scale_length, pad1; /* maybe have other unit conversions? */
char unit_system, unit_flag; /* imperial, metric etc */
short dpi; /* range 48-128? */
int dpi; /* range 48-128? */
short encoding;
short transopts;
short menuthreshold1, menuthreshold2;
@@ -418,13 +416,6 @@ extern UserDef U; /* from blenkernel blender.c */
/* toolsettings->autokey_flag */
#define ANIMRECORD_FLAG_WITHNLA (1<<10)
/* unit_type */
#define USER_UNIT_NONE 0
#define USER_UNIT_METRIC 1
#define USER_UNIT_IMPERIAL 2
/* unit_flag */
#define USER_UNIT_OPT_SPLIT 1
/* transopts */
#define USER_TR_TOOLTIPS (1 << 0)
#define USER_TR_BUTTONS (1 << 1)

View File

@@ -470,6 +470,7 @@ extern StructRNA RNA_TransformSequence;
extern StructRNA RNA_UILayout;
extern StructRNA RNA_UIListItem;
extern StructRNA RNA_UVProjectModifier;
extern StructRNA RNA_UnitSettings;
extern StructRNA RNA_UnknownType;
extern StructRNA RNA_UserPreferences;
extern StructRNA RNA_UserPreferencesAutosave;

View File

@@ -416,7 +416,7 @@ static void rna_def_constraint_kinematic(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Pole Sub-Target", "");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
prop= RNA_def_property(srna, "pole_angle", PROP_FLOAT, PROP_NONE);
prop= RNA_def_property(srna, "pole_angle", PROP_FLOAT, PROP_ANGLE); // XXX - todo, convert to rad
RNA_def_property_float_sdna(prop, NULL, "poleangle");
RNA_def_property_range(prop, 0.0, 180.f);
RNA_def_property_ui_text(prop, "Pole Angle", "Pole rotation offset.");
@@ -676,7 +676,7 @@ static void rna_def_constraint_minmax(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Use Rotation", "Use the target's rotation to determine floor.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
prop= RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
prop= RNA_def_property(srna, "offset", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_range(prop, 0.0, 100.f);
RNA_def_property_ui_text(prop, "Offset", "Offset of floor from object center.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
@@ -871,7 +871,7 @@ static void rna_def_constraint_follow_path(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
prop= RNA_def_property(srna, "offset", PROP_INT, PROP_NONE);
prop= RNA_def_property(srna, "offset", PROP_INT, PROP_TIME);
RNA_def_property_range(prop, -300000.0, 300000.f);
RNA_def_property_ui_text(prop, "Offset", "Offset from the position corresponding to the time frame.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
@@ -938,7 +938,7 @@ static void rna_def_constraint_stretch_to(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Keep Axis", "Axis to maintain during stretch.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
prop= RNA_def_property(srna, "original_length", PROP_FLOAT, PROP_NONE);
prop= RNA_def_property(srna, "original_length", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "orglength");
RNA_def_property_range(prop, 0.0, 100.f);
RNA_def_property_ui_text(prop, "Original Length", "Length at rest position.");
@@ -983,37 +983,37 @@ static void rna_def_constraint_rigid_body_joint(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Pivot Type", "");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
prop= RNA_def_property(srna, "pivot_x", PROP_FLOAT, PROP_NONE);
prop= RNA_def_property(srna, "pivot_x", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "pivX");
RNA_def_property_range(prop, -1000.0, 1000.f);
RNA_def_property_ui_text(prop, "Pivot X", "Offset pivot on X.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
prop= RNA_def_property(srna, "pivot_y", PROP_FLOAT, PROP_NONE);
prop= RNA_def_property(srna, "pivot_y", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "pivY");
RNA_def_property_range(prop, -1000.0, 1000.f);
RNA_def_property_ui_text(prop, "Pivot Y", "Offset pivot on Y.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
prop= RNA_def_property(srna, "pivot_z", PROP_FLOAT, PROP_NONE);
prop= RNA_def_property(srna, "pivot_z", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "pivZ");
RNA_def_property_range(prop, -1000.0, 1000.f);
RNA_def_property_ui_text(prop, "Pivot Z", "Offset pivot on Z.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
prop= RNA_def_property(srna, "axis_x", PROP_FLOAT, PROP_NONE);
prop= RNA_def_property(srna, "axis_x", PROP_FLOAT, PROP_ANGLE); // XXX - convert to radians
RNA_def_property_float_sdna(prop, NULL, "axX");
RNA_def_property_range(prop, -360.0, 360.f);
RNA_def_property_ui_text(prop, "Axis X", "Rotate pivot on X axis in degrees.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
prop= RNA_def_property(srna, "axis_y", PROP_FLOAT, PROP_NONE);
prop= RNA_def_property(srna, "axis_y", PROP_FLOAT, PROP_ANGLE); // XXX - convert to radians
RNA_def_property_float_sdna(prop, NULL, "axY");
RNA_def_property_range(prop, -360.0, 360.f);
RNA_def_property_ui_text(prop, "Axis Y", "Rotate pivot on Y axis in degrees.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
prop= RNA_def_property(srna, "axis_z", PROP_FLOAT, PROP_NONE);
prop= RNA_def_property(srna, "axis_z", PROP_FLOAT, PROP_ANGLE); // XXX - convert to radians
RNA_def_property_float_sdna(prop, NULL, "axZ");
RNA_def_property_range(prop, -360.0, 360.f);
RNA_def_property_ui_text(prop, "Axis Z", "Rotate pivot on Z axis in degrees.");
@@ -1135,73 +1135,73 @@ static void rna_def_constraint_transform(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Extrapolate Motion", "Extrapolate ranges.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
prop= RNA_def_property(srna, "from_min_x", PROP_FLOAT, PROP_NONE);
prop= RNA_def_property(srna, "from_min_x", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "from_min[0]");
RNA_def_property_range(prop, 0.0, 1000.f);
RNA_def_property_ui_text(prop, "From Minimum X", "Bottom range of X axis source motion.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
prop= RNA_def_property(srna, "from_min_y", PROP_FLOAT, PROP_NONE);
prop= RNA_def_property(srna, "from_min_y", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "from_min[1]");
RNA_def_property_range(prop, 0.0, 1000.f);
RNA_def_property_ui_text(prop, "From Minimum Y", "Bottom range of Y axis source motion.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
prop= RNA_def_property(srna, "from_min_z", PROP_FLOAT, PROP_NONE);
prop= RNA_def_property(srna, "from_min_z", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "from_min[2]");
RNA_def_property_range(prop, 0.0, 1000.f);
RNA_def_property_ui_text(prop, "From Minimum Z", "Bottom range of Z axis source motion.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
prop= RNA_def_property(srna, "from_max_x", PROP_FLOAT, PROP_NONE);
prop= RNA_def_property(srna, "from_max_x", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "from_max[0]");
RNA_def_property_range(prop, 0.0, 1000.f);
RNA_def_property_ui_text(prop, "From Maximum X", "Top range of X axis source motion.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
prop= RNA_def_property(srna, "from_max_y", PROP_FLOAT, PROP_NONE);
prop= RNA_def_property(srna, "from_max_y", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "from_max[1]");
RNA_def_property_range(prop, 0.0, 1000.f);
RNA_def_property_ui_text(prop, "From Maximum Y", "Top range of Y axis source motion.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
prop= RNA_def_property(srna, "from_max_z", PROP_FLOAT, PROP_NONE);
prop= RNA_def_property(srna, "from_max_z", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "from_max[2]");
RNA_def_property_range(prop, 0.0, 1000.f);
RNA_def_property_ui_text(prop, "From Maximum Z", "Top range of Z axis source motion.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
prop= RNA_def_property(srna, "to_min_x", PROP_FLOAT, PROP_NONE);
prop= RNA_def_property(srna, "to_min_x", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "to_min[0]");
RNA_def_property_range(prop, 0.0, 1000.f);
RNA_def_property_ui_text(prop, "To Minimum X", "Bottom range of X axis destination motion.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
prop= RNA_def_property(srna, "to_min_y", PROP_FLOAT, PROP_NONE);
prop= RNA_def_property(srna, "to_min_y", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "to_min[1]");
RNA_def_property_range(prop, 0.0, 1000.f);
RNA_def_property_ui_text(prop, "To Minimum Y", "Bottom range of Y axis destination motion.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
prop= RNA_def_property(srna, "to_min_z", PROP_FLOAT, PROP_NONE);
prop= RNA_def_property(srna, "to_min_z", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "to_min[2]");
RNA_def_property_range(prop, 0.0, 1000.f);
RNA_def_property_ui_text(prop, "To Minimum Z", "Bottom range of Z axis destination motion.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
prop= RNA_def_property(srna, "to_max_x", PROP_FLOAT, PROP_NONE);
prop= RNA_def_property(srna, "to_max_x", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "to_max[0]");
RNA_def_property_range(prop, 0.0, 1000.f);
RNA_def_property_ui_text(prop, "To Maximum X", "Top range of X axis destination motion.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
prop= RNA_def_property(srna, "to_max_y", PROP_FLOAT, PROP_NONE);
prop= RNA_def_property(srna, "to_max_y", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "to_max[1]");
RNA_def_property_range(prop, 0.0, 1000.f);
RNA_def_property_ui_text(prop, "To Maximum Y", "Top range of Y axis destination motion.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
prop= RNA_def_property(srna, "to_max_z", PROP_FLOAT, PROP_NONE);
prop= RNA_def_property(srna, "to_max_z", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "to_max[2]");
RNA_def_property_range(prop, 0.0, 1000.f);
RNA_def_property_ui_text(prop, "To Maximum Z", "Top range of Z axis destination motion.");
@@ -1247,37 +1247,37 @@ static void rna_def_constraint_location_limit(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Maximum Z", "Use the maximum Z value.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
prop= RNA_def_property(srna, "minimum_x", PROP_FLOAT, PROP_NONE);
prop= RNA_def_property(srna, "minimum_x", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "xmin");
RNA_def_property_range(prop, -1000.0, 1000.f);
RNA_def_property_ui_text(prop, "Minimum X", "Lowest X value to allow.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
prop= RNA_def_property(srna, "minimum_y", PROP_FLOAT, PROP_NONE);
prop= RNA_def_property(srna, "minimum_y", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "ymin");
RNA_def_property_range(prop, -1000.0, 1000.f);
RNA_def_property_ui_text(prop, "Minimum Y", "Lowest Y value to allow.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
prop= RNA_def_property(srna, "minimum_z", PROP_FLOAT, PROP_NONE);
prop= RNA_def_property(srna, "minimum_z", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "zmin");
RNA_def_property_range(prop, -1000.0, 1000.f);
RNA_def_property_ui_text(prop, "Minimum Z", "Lowest Z value to allow.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
prop= RNA_def_property(srna, "maximum_x", PROP_FLOAT, PROP_NONE);
prop= RNA_def_property(srna, "maximum_x", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "xmax");
RNA_def_property_range(prop, -1000.0, 1000.f);
RNA_def_property_ui_text(prop, "Maximum X", "Highest X value to allow.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
prop= RNA_def_property(srna, "maximum_y", PROP_FLOAT, PROP_NONE);
prop= RNA_def_property(srna, "maximum_y", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "ymax");
RNA_def_property_range(prop, -1000.0, 1000.f);
RNA_def_property_ui_text(prop, "Maximum Y", "Highest Y value to allow.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
prop= RNA_def_property(srna, "maximum_z", PROP_FLOAT, PROP_NONE);
prop= RNA_def_property(srna, "maximum_z", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "zmax");
RNA_def_property_range(prop, -1000.0, 1000.f);
RNA_def_property_ui_text(prop, "Maximum Z", "Highest Z value to allow.");
@@ -1313,37 +1313,37 @@ static void rna_def_constraint_rotation_limit(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Limit Z", "Use the minimum Z value.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
prop= RNA_def_property(srna, "minimum_x", PROP_FLOAT, PROP_NONE);
prop= RNA_def_property(srna, "minimum_x", PROP_FLOAT, PROP_ANGLE);
RNA_def_property_float_sdna(prop, NULL, "xmin");
RNA_def_property_range(prop, -1000.0, 1000.f);
RNA_def_property_ui_text(prop, "Minimum X", "Lowest X value to allow.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
prop= RNA_def_property(srna, "minimum_y", PROP_FLOAT, PROP_NONE);
prop= RNA_def_property(srna, "minimum_y", PROP_FLOAT, PROP_ANGLE);
RNA_def_property_float_sdna(prop, NULL, "ymin");
RNA_def_property_range(prop, -1000.0, 1000.f);
RNA_def_property_ui_text(prop, "Minimum Y", "Lowest Y value to allow.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
prop= RNA_def_property(srna, "minimum_z", PROP_FLOAT, PROP_NONE);
prop= RNA_def_property(srna, "minimum_z", PROP_FLOAT, PROP_ANGLE);
RNA_def_property_float_sdna(prop, NULL, "zmin");
RNA_def_property_range(prop, -1000.0, 1000.f);
RNA_def_property_ui_text(prop, "Minimum Z", "Lowest Z value to allow.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
prop= RNA_def_property(srna, "maximum_x", PROP_FLOAT, PROP_NONE);
prop= RNA_def_property(srna, "maximum_x", PROP_FLOAT, PROP_ANGLE);
RNA_def_property_float_sdna(prop, NULL, "xmax");
RNA_def_property_range(prop, -1000.0, 1000.f);
RNA_def_property_ui_text(prop, "Maximum X", "Highest X value to allow.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
prop= RNA_def_property(srna, "maximum_y", PROP_FLOAT, PROP_NONE);
prop= RNA_def_property(srna, "maximum_y", PROP_FLOAT, PROP_ANGLE);
RNA_def_property_float_sdna(prop, NULL, "ymax");
RNA_def_property_range(prop, -1000.0, 1000.f);
RNA_def_property_ui_text(prop, "Maximum Y", "Highest Y value to allow.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
prop= RNA_def_property(srna, "maximum_z", PROP_FLOAT, PROP_NONE);
prop= RNA_def_property(srna, "maximum_z", PROP_FLOAT, PROP_ANGLE);
RNA_def_property_float_sdna(prop, NULL, "zmax");
RNA_def_property_range(prop, -1000.0, 1000.f);
RNA_def_property_ui_text(prop, "Maximum Z", "Highest Z value to allow.");
@@ -1462,7 +1462,7 @@ static void rna_def_constraint_distance_limit(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Sub-Target", "");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "dist");
RNA_def_property_range(prop, 0.0, 100.f);
RNA_def_property_ui_text(prop, "Distance", "Radius of limiting sphere.");
@@ -1502,7 +1502,7 @@ static void rna_def_constraint_shrinkwrap(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Shrinkwrap Type", "Selects type of shrinkwrap algorithm for target position");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "dist");
RNA_def_property_range(prop, 0.0, 100.f);
RNA_def_property_ui_text(prop, "Distance", "Distance to Target.");

View File

@@ -448,6 +448,40 @@ static void rna_def_tool_settings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Vertex Group Weight", "Weight to assign in vertex groups.");
}
static void rna_def_unit_settings(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
static EnumPropertyItem unit_systems[] = {
{USER_UNIT_NONE, "NONE", 0, "None", ""},
{USER_UNIT_METRIC, "METRIC", 0, "Metric", ""},
{USER_UNIT_IMPERIAL, "IMPERIAL", 0, "Imperial", ""},
{0, NULL, 0, NULL, NULL}};
srna= RNA_def_struct(brna, "UnitSettings", NULL);
RNA_def_struct_ui_text(srna, "Unit Settings", "");
/* Units */
prop= RNA_def_property(srna, "system", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, unit_systems);
RNA_def_property_ui_text(prop, "Unit System", "The unit system to use for button display.");
RNA_def_property_update(prop, NC_WINDOW, NULL);
prop= RNA_def_property(srna, "scale_length", PROP_FLOAT, PROP_UNSIGNED);
RNA_def_property_ui_text(prop, "Unit Scale", "Scale to use when converting between blender units and dimensions.");
RNA_def_property_range(prop, 0.00001, 100000.0);
RNA_def_property_ui_range(prop, 0.001, 100.0, 0.1, 3);
RNA_def_property_update(prop, NC_WINDOW, NULL);
prop= RNA_def_property(srna, "use_separate", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_UNIT_OPT_SPLIT);
RNA_def_property_ui_text(prop, "Separate Units", "Display units in pairs.");
RNA_def_property_update(prop, NC_WINDOW, NULL);
}
void rna_def_render_layer_common(StructRNA *srna, int scene)
{
PropertyRNA *prop;
@@ -1749,6 +1783,12 @@ void RNA_def_scene(BlenderRNA *brna)
RNA_def_property_pointer_sdna(prop, NULL, "toolsettings");
RNA_def_property_struct_type(prop, "ToolSettings");
RNA_def_property_ui_text(prop, "Tool Settings", "");
/* Unit Settings */
prop= RNA_def_property(srna, "unit_settings", PROP_POINTER, PROP_NEVER_NULL);
RNA_def_property_pointer_sdna(prop, NULL, "unit");
RNA_def_property_struct_type(prop, "UnitSettings");
RNA_def_property_ui_text(prop, "Unit Settings", "Unit editing settings");
/* Render Data */
prop= RNA_def_property(srna, "render_data", PROP_POINTER, PROP_NEVER_NULL);
@@ -1769,6 +1809,7 @@ void RNA_def_scene(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Game Data", "");
rna_def_tool_settings(brna);
rna_def_unit_settings(brna);
rna_def_scene_render_data(brna);
rna_def_scene_game_data(brna);
rna_def_scene_render_layer(brna);

View File

@@ -1733,12 +1733,6 @@ static void rna_def_userdef_edit(BlenderRNA *brna)
{BEZT_IPO_BEZ, "BEZIER", 0, "Bezier", ""},
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem unit_systems[] = {
{USER_UNIT_NONE, "NONE", 0, "None", ""},
{USER_UNIT_METRIC, "METRIC", 0, "Metric", ""},
{USER_UNIT_IMPERIAL, "IMPERIAL", 0, "Imperial", ""},
{0, NULL, 0, NULL, NULL}};
srna= RNA_def_struct(brna, "UserPreferencesEdit", NULL);
RNA_def_struct_sdna(srna, "UserDef");
RNA_def_struct_nested(brna, srna, "UserPreferences");
@@ -1779,23 +1773,6 @@ static void rna_def_userdef_edit(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_GLOBALUNDO);
RNA_def_property_ui_text(prop, "Global Undo", "Global undo works by keeping a full copy of the file itself in memory, so takes extra memory.");
/* Units */
prop= RNA_def_property(srna, "unit_system", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, unit_systems);
RNA_def_property_ui_text(prop, "Unit System", "The unit system to use for button display.");
RNA_def_property_update(prop, NC_WINDOW, NULL);
prop= RNA_def_property(srna, "unit_scale_length", PROP_FLOAT, PROP_UNSIGNED);
RNA_def_property_ui_text(prop, "Unit Scale", "Scale to use when converting between blender units and dimensions.");
RNA_def_property_range(prop, 0.00001, 100000.0);
RNA_def_property_ui_range(prop, 0.001, 100.0, 0.1, 3);
RNA_def_property_update(prop, NC_WINDOW, NULL);
prop= RNA_def_property(srna, "use_unit_split", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "unit_flag", USER_UNIT_OPT_SPLIT);
RNA_def_property_ui_text(prop, "Separate Units", "Display units in pairs.");
RNA_def_property_update(prop, NC_WINDOW, NULL);
/* snap to grid */
prop= RNA_def_property(srna, "snap_translate", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_AUTOGRABGRID);