Merge branch 'master' of gitorious.org:fg/fgdata
This commit is contained in:
commit
9078b6ff36
4 changed files with 62 additions and 35 deletions
|
@ -137,17 +137,10 @@ var Element = {
|
|||
# @param ghost Element ghost as retrieved from core methods
|
||||
new: func(ghost)
|
||||
{
|
||||
var m = {
|
||||
return {
|
||||
parents: [PropertyElement, Element, ghost],
|
||||
_node: props.wrapNode(ghost._node_ghost)
|
||||
};
|
||||
|
||||
m._center = [
|
||||
m._node.getNode("center[0]"),
|
||||
m._node.getNode("center[1]")
|
||||
];
|
||||
|
||||
return m;
|
||||
},
|
||||
# Trigger an update of the element
|
||||
#
|
||||
|
@ -229,6 +222,22 @@ var Element = {
|
|||
|
||||
return [0, 0, 0, 0];
|
||||
},
|
||||
# Calculate the transformation center based on bounding box and center-offset
|
||||
updateCenter: func
|
||||
{
|
||||
me.update();
|
||||
var bb = me.getTransformedBounds();
|
||||
|
||||
if( bb[0] > bb[2] or bb[1] > bb[3] )
|
||||
return;
|
||||
|
||||
me._setupCenterNodes
|
||||
(
|
||||
(bb[0] + bb[2]) / 2 + (me.get("center-offset-x") or 0),
|
||||
(bb[1] + bb[3]) / 2 + (me.get("center-offset-y") or 0)
|
||||
);
|
||||
return me;
|
||||
},
|
||||
# Set transformation center (currently only used for rotation)
|
||||
setCenter: func()
|
||||
{
|
||||
|
@ -236,24 +245,13 @@ var Element = {
|
|||
if( size(center) != 2 )
|
||||
return debug.warn("invalid arg");
|
||||
|
||||
me._setupCenterNodes();
|
||||
|
||||
if( me._center[0] == nil )
|
||||
me._center[0] = me._node.getNode("center[0]", 1);
|
||||
if( me._center[1] == nil )
|
||||
me._center[1] = me._node.getNode("center[1]", 1);
|
||||
|
||||
me._center[0].setDoubleValue(center[0] or 0);
|
||||
me._center[1].setDoubleValue(center[1] or 0);
|
||||
|
||||
me._setupCenterNodes(center[0], center[1]);
|
||||
return me;
|
||||
},
|
||||
# Get transformation center
|
||||
getCenter: func()
|
||||
{
|
||||
var bb = me.getBoundingBox();
|
||||
var center = [0, 0];
|
||||
|
||||
me._setupCenterNodes();
|
||||
|
||||
if( me._center[0] != nil )
|
||||
|
@ -261,11 +259,7 @@ var Element = {
|
|||
if( me._center[1] != nil )
|
||||
center[1] = me._center[1].getValue() or 0;
|
||||
|
||||
if( bb[0] >= bb[2] or bb[1] >= bb[3] )
|
||||
return center;
|
||||
|
||||
return [ 0.5 * (bb[0] + bb[2]) + center[0],
|
||||
0.5 * (bb[1] + bb[3]) + center[1] ];
|
||||
return center;
|
||||
},
|
||||
# Internal Transform for convenience transform functions
|
||||
_getTf: func
|
||||
|
@ -274,13 +268,18 @@ var Element = {
|
|||
me['_tf'] = me.createTransform();
|
||||
return me._tf;
|
||||
},
|
||||
_setupCenterNodes: func()
|
||||
_setupCenterNodes: func(cx = nil, cy = nil)
|
||||
{
|
||||
if( me["_center"] == nil )
|
||||
me["_center"] = [
|
||||
me._node.getNode("center[0]"),
|
||||
me._node.getNode("center[1]")
|
||||
me._node.getNode("center[0]", cx != nil),
|
||||
me._node.getNode("center[1]", cy != nil)
|
||||
];
|
||||
|
||||
if( cx != nil )
|
||||
me._center[0].setDoubleValue(cx);
|
||||
if( cy != nil )
|
||||
me._center[1].setDoubleValue(cy);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -357,11 +357,6 @@ var parsesvg = func(group, path, options = nil)
|
|||
if( dash and size(dash) > 3 )
|
||||
# at least 2 comma separated values...
|
||||
stack[-1].setStrokeDashArray(split(',', dash));
|
||||
|
||||
var cx = attr['inkscape:transform-center-x'];
|
||||
var cy = attr['inkscape:transform-center-y'];
|
||||
if( cx != nil or cy != nil )
|
||||
stack[-1].setCenter(cx or 0, -(cy or 0));
|
||||
}
|
||||
else if( name == "tspan" )
|
||||
{
|
||||
|
@ -392,6 +387,14 @@ var parsesvg = func(group, path, options = nil)
|
|||
}
|
||||
|
||||
parseTransform(attr['transform']);
|
||||
|
||||
var cx = attr['inkscape:transform-center-x'];
|
||||
if( cx != nil and cx != 0 )
|
||||
stack[-1].setDouble("center-offset-x", cx);
|
||||
|
||||
var cy = attr['inkscape:transform-center-y'];
|
||||
if( cy != nil and cy != 0 )
|
||||
stack[-1].setDouble("center-offset-y", -cy);
|
||||
};
|
||||
|
||||
# XML parsers element close callback
|
||||
|
@ -423,8 +426,21 @@ var parsesvg = func(group, path, options = nil)
|
|||
stack[-1].setText(data);
|
||||
};
|
||||
|
||||
if( path[0] != '/' )
|
||||
path = getprop("/sim/fg-root") ~ "/" ~ path;
|
||||
# check path relative to standard locations
|
||||
foreach(
|
||||
var p;
|
||||
[ "", # absolute path
|
||||
getprop("/sim/aircraft-dir") ~ "/", # current aircraft path
|
||||
getprop("/sim/fg-root") ~ "/" # fgdata
|
||||
])
|
||||
{
|
||||
var tmp_path = p ~ path;
|
||||
if( io.stat(tmp_path) != nil )
|
||||
{
|
||||
path = tmp_path;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
call(func parsexml(path, start, end, data), nil, var err = []);
|
||||
if( size(err) )
|
||||
|
|
|
@ -172,6 +172,12 @@ setprop("/sim/rendering/clouds3d-wrap",0);
|
|||
# Basic Weather rain altitude limit off
|
||||
props.globals.getNode("/environment/params/use-external-precipitation-level").setBoolValue("true");
|
||||
|
||||
|
||||
# rain and snow off for clean startup
|
||||
|
||||
compat_layer.setRain(0.0);
|
||||
compat_layer.setSnow(0.0);
|
||||
compat_layer.setLight(1.0);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1663,6 +1663,12 @@ setprop(lw~"clouds/placement-index",0);
|
|||
setprop(lw~"clouds/model-placement-index",0);
|
||||
setprop(lw~"effect-volumes/effect-placement-index",0);
|
||||
setprop(lw~"effect-volumes/number",0);
|
||||
setprop(lw~"effect-volumes/number-active-rain",0);
|
||||
setprop(lw~"effect-volumes/number-active-snow",0);
|
||||
setprop(lw~"effect-volumes/number-active-vis",0);
|
||||
setprop(lw~"effect-volumes/number-active-turb",0);
|
||||
setprop(lw~"effect-volumes/number-active-lift",0);
|
||||
setprop(lw~"effect-volumes/number-active-sat",0);
|
||||
setprop(lw~"tiles/tile-counter",0);
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue