Compare commits

...
Author SHA1 Message Date
James Turner 635f460dd5 Nasal: improve message for non-object member access
Based on some discussion on this ticket:

https://sourceforge.net/p/flightgear/codetickets/2186/

Make this message slightly clearer.
2020-05-03 12:22:23 +01:00
James Turner 36316e8859 Add Canvas::Image.dirtyPixels() 2020-05-03 12:22:11 +01:00
3 changed files with 16 additions and 3 deletions
+10 -2
View File
@@ -947,10 +947,18 @@ SGRect<int> intersectRect(const SGRect<int>& a, const SGRect<int>& b)
}
image->setColor(color, x, y);
auto c = getCanvas().lock();
c->enableRendering(true); // force a repaint
}
void Image::dirtyPixels()
{
osg::ref_ptr<osg::Image> image = _texture->getImage();
if (!image)
return;
image->dirty();
auto c = getCanvas().lock();
c->enableRendering(true); // force a repaint
}
void Image::allocateImage()
{
osg::Image* image = new osg::Image;
+5
View File
@@ -115,6 +115,11 @@ namespace canvas
void setPixel(int x, int y, const osg::Vec4& color);
/**
* mark the image pixels as modified, so the canvas is re-painted
*/
void dirtyPixels();
osg::ref_ptr<osg::Image> getImage() const;
// void setRow(int row, int offset, )
+1 -1
View File
@@ -503,7 +503,7 @@ static void setMember(naContext ctx, naRef obj, naRef fld, naRef value)
return;
}
if(!IS_HASH(obj)) ERR(ctx, "non-objects have no members");
if(!IS_HASH(obj)) naRuntimeError(ctx, "non-object does not have member: %s", naStr_data(fld));
naHash_set(obj, fld, value);
ctx->opTop -= 2;
}