Added new setFont(ref_ptr<>) variants to Text and Text3D
This commit is contained in:
@@ -67,12 +67,12 @@ Text::~Text()
|
||||
{
|
||||
}
|
||||
|
||||
void Text::setFont(Font* font)
|
||||
void Text::setFont(osg::ref_ptr<Font> font)
|
||||
{
|
||||
if (_font==font) return;
|
||||
|
||||
osg::StateSet* previousFontStateSet = _font.valid() ? _font->getStateSet() : DefaultFont::instance()->getStateSet();
|
||||
osg::StateSet* newFontStateSet = font ? font->getStateSet() : DefaultFont::instance()->getStateSet();
|
||||
osg::StateSet* newFontStateSet = font.valid() ? font->getStateSet() : DefaultFont::instance()->getStateSet();
|
||||
|
||||
if (getStateSet() == previousFontStateSet)
|
||||
{
|
||||
@@ -86,7 +86,7 @@ void Text::setFont(Font* font)
|
||||
|
||||
void Text::setFont(const std::string& fontfile)
|
||||
{
|
||||
setFont(readRefFontFile(fontfile).get());
|
||||
setFont(readRefFontFile(fontfile));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ Text3D::Text3D(const Text3D & text3D, const osg::CopyOp & copyop):
|
||||
// TODO
|
||||
//}
|
||||
|
||||
void Text3D::setFont(Font3D * font)
|
||||
void Text3D::setFont(osg::ref_ptr<Font3D> font)
|
||||
{
|
||||
_font = font;
|
||||
|
||||
@@ -51,7 +51,7 @@ void Text3D::setFont(Font3D * font)
|
||||
|
||||
void Text3D::setFont(const std::string & fontfile)
|
||||
{
|
||||
setFont(readRefFont3DFile(fontfile).get());
|
||||
setFont(readRefFont3DFile(fontfile));
|
||||
}
|
||||
|
||||
String::iterator Text3D::computeLastCharacterOnLine(osg::Vec2& cursor, String::iterator first,String::iterator last)
|
||||
|
||||
@@ -99,6 +99,11 @@ BEGIN_OBJECT_REFLECTOR(osgText::Text)
|
||||
__void__setFont__Font_P1,
|
||||
"Set the Font to use to render the text. ",
|
||||
"setFont(0) sets the use of the default font. ");
|
||||
I_Method1(void, setFont, IN, osg::ref_ptr< osgText::Font >, font,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__setFont__osg_ref_ptrT1_Font_,
|
||||
"Set the Font to use to render the text. ",
|
||||
"");
|
||||
I_Method1(void, setFont, IN, const std::string &, fontfile,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__setFont__C5_std_string_R1,
|
||||
@@ -421,9 +426,9 @@ BEGIN_OBJECT_REFLECTOR(osgText::Text)
|
||||
I_SimpleProperty(const osg::Vec4 &, ColorGradientTopRight,
|
||||
__C5_osg_Vec4_R1__getColorGradientTopRight,
|
||||
0);
|
||||
I_SimpleProperty(osgText::Font *, Font,
|
||||
I_SimpleProperty(osg::ref_ptr< osgText::Font >, Font,
|
||||
0,
|
||||
__void__setFont__Font_P1);
|
||||
__void__setFont__osg_ref_ptrT1_Font_);
|
||||
I_SimpleProperty(const osgText::Text::TextureGlyphQuadMap &, TextureGlyphQuadMap,
|
||||
__C5_TextureGlyphQuadMap_R1__getTextureGlyphQuadMap,
|
||||
0);
|
||||
@@ -519,6 +524,46 @@ BEGIN_VALUE_REFLECTOR(osgText::Text::GlyphQuads)
|
||||
I_PublicMemberProperty(osgText::Text::GlyphQuads::ColorCoords, _colorCoords);
|
||||
END_REFLECTOR
|
||||
|
||||
BEGIN_VALUE_REFLECTOR(osg::ref_ptr< osgText::Font >)
|
||||
I_DeclaringFile("osg/ref_ptr");
|
||||
I_Constructor0(____ref_ptr,
|
||||
"",
|
||||
"");
|
||||
I_Constructor1(IN, osgText::Font *, ptr,
|
||||
Properties::NON_EXPLICIT,
|
||||
____ref_ptr__T_P1,
|
||||
"",
|
||||
"");
|
||||
I_Constructor1(IN, const osg::ref_ptr< osgText::Font > &, rp,
|
||||
Properties::NON_EXPLICIT,
|
||||
____ref_ptr__C5_ref_ptr_R1,
|
||||
"",
|
||||
"");
|
||||
I_Method0(osgText::Font *, get,
|
||||
Properties::NON_VIRTUAL,
|
||||
__T_P1__get,
|
||||
"",
|
||||
"");
|
||||
I_Method0(bool, valid,
|
||||
Properties::NON_VIRTUAL,
|
||||
__bool__valid,
|
||||
"",
|
||||
"");
|
||||
I_Method0(osgText::Font *, release,
|
||||
Properties::NON_VIRTUAL,
|
||||
__T_P1__release,
|
||||
"",
|
||||
"");
|
||||
I_Method1(void, swap, IN, osg::ref_ptr< osgText::Font > &, rp,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__swap__ref_ptr_R1,
|
||||
"",
|
||||
"");
|
||||
I_SimpleProperty(osgText::Font *, ,
|
||||
__T_P1__get,
|
||||
0);
|
||||
END_REFLECTOR
|
||||
|
||||
BEGIN_VALUE_REFLECTOR(osg::ref_ptr< osgText::Font::GlyphTexture >)
|
||||
I_DeclaringFile("osg/ref_ptr");
|
||||
I_Constructor0(____ref_ptr,
|
||||
|
||||
@@ -93,6 +93,11 @@ BEGIN_OBJECT_REFLECTOR(osgText::Text3D)
|
||||
__void__setFont__Font3D_P1,
|
||||
"Set the Font to use to render the text. ",
|
||||
"setFont(0) sets the use of the default font. ");
|
||||
I_Method1(void, setFont, IN, osg::ref_ptr< osgText::Font3D >, font,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__setFont__osg_ref_ptrT1_Font3D_,
|
||||
"Set the Font to use to render the text. ",
|
||||
"");
|
||||
I_Method1(void, setFont, IN, const std::string &, fontfile,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__setFont__C5_std_string_R1,
|
||||
@@ -171,9 +176,9 @@ BEGIN_OBJECT_REFLECTOR(osgText::Text3D)
|
||||
I_SimpleProperty(float, CharacterDepth,
|
||||
__float__getCharacterDepth,
|
||||
__void__setCharacterDepth__float);
|
||||
I_SimpleProperty(osgText::Font3D *, Font,
|
||||
I_SimpleProperty(osg::ref_ptr< osgText::Font3D >, Font,
|
||||
0,
|
||||
__void__setFont__Font3D_P1);
|
||||
__void__setFont__osg_ref_ptrT1_Font3D_);
|
||||
I_SimpleProperty(osgText::Text3D::RenderMode, RenderMode,
|
||||
__RenderMode__getRenderMode,
|
||||
__void__setRenderMode__RenderMode);
|
||||
@@ -182,3 +187,43 @@ BEGIN_OBJECT_REFLECTOR(osgText::Text3D)
|
||||
__void__setThreadSafeRefUnref__bool);
|
||||
END_REFLECTOR
|
||||
|
||||
BEGIN_VALUE_REFLECTOR(osg::ref_ptr< osgText::Font3D >)
|
||||
I_DeclaringFile("osg/ref_ptr");
|
||||
I_Constructor0(____ref_ptr,
|
||||
"",
|
||||
"");
|
||||
I_Constructor1(IN, osgText::Font3D *, ptr,
|
||||
Properties::NON_EXPLICIT,
|
||||
____ref_ptr__T_P1,
|
||||
"",
|
||||
"");
|
||||
I_Constructor1(IN, const osg::ref_ptr< osgText::Font3D > &, rp,
|
||||
Properties::NON_EXPLICIT,
|
||||
____ref_ptr__C5_ref_ptr_R1,
|
||||
"",
|
||||
"");
|
||||
I_Method0(osgText::Font3D *, get,
|
||||
Properties::NON_VIRTUAL,
|
||||
__T_P1__get,
|
||||
"",
|
||||
"");
|
||||
I_Method0(bool, valid,
|
||||
Properties::NON_VIRTUAL,
|
||||
__bool__valid,
|
||||
"",
|
||||
"");
|
||||
I_Method0(osgText::Font3D *, release,
|
||||
Properties::NON_VIRTUAL,
|
||||
__T_P1__release,
|
||||
"",
|
||||
"");
|
||||
I_Method1(void, swap, IN, osg::ref_ptr< osgText::Font3D > &, rp,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__swap__ref_ptr_R1,
|
||||
"",
|
||||
"");
|
||||
I_SimpleProperty(osgText::Font3D *, ,
|
||||
__T_P1__get,
|
||||
0);
|
||||
END_REFLECTOR
|
||||
|
||||
|
||||
Reference in New Issue
Block a user