Merge with default
30
.hgignore
|
@ -43,7 +43,6 @@ default_c
|
||||||
*.so
|
*.so
|
||||||
*.so.*
|
*.so.*
|
||||||
*_debug
|
*_debug
|
||||||
core
|
|
||||||
*.pc
|
*.pc
|
||||||
*.gch
|
*.gch
|
||||||
|
|
||||||
|
@ -204,16 +203,7 @@ code/nel/tools/pacs/build_rbank/build_rbank
|
||||||
code/ryzom/common/data_leveldesign/leveldesign/game_element/xp_table/skills.skill_tree
|
code/ryzom/common/data_leveldesign/leveldesign/game_element/xp_table/skills.skill_tree
|
||||||
code/ryzom/common/data_leveldesign/leveldesign/game_element/xp_table/xptable.xp_table
|
code/ryzom/common/data_leveldesign/leveldesign/game_element/xp_table/xptable.xp_table
|
||||||
code/ryzom/tools/server/sql/ryzom_admin_default_data.sql
|
code/ryzom/tools/server/sql/ryzom_admin_default_data.sql
|
||||||
code/ryzom/tools/server/ryzom_ams/drupal
|
|
||||||
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/autoload
|
|
||||||
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/configs
|
|
||||||
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/cron
|
|
||||||
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/img
|
|
||||||
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/plugins
|
|
||||||
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/smarty
|
|
||||||
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/translations
|
|
||||||
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/libinclude.php
|
|
||||||
code/ryzom/tools/server/ryzom_ams/www/html/templates_c
|
|
||||||
|
|
||||||
# Linux server compile
|
# Linux server compile
|
||||||
code/ryzom/server/src/entities_game_service/entities_game_service
|
code/ryzom/server/src/entities_game_service/entities_game_service
|
||||||
|
@ -227,11 +217,23 @@ code/ryzom/server/src/ryzom_welcome_service/ryzom_welcome_service
|
||||||
code/ryzom/server/src/tick_service/tick_service
|
code/ryzom/server/src/tick_service/tick_service
|
||||||
# WebTT temp dir
|
# WebTT temp dir
|
||||||
code/ryzom/tools/server/www/webtt/app/tmp
|
code/ryzom/tools/server/www/webtt/app/tmp
|
||||||
code\ryzom\tools\server\ryzom_ams\old
|
|
||||||
|
|
||||||
# AMS ignore
|
# AMS ignore
|
||||||
code/ryzom/tools/server/ryzom_ams/www/config.php
|
code/web/public_php/ams/is_installed
|
||||||
code/ryzom/tools/server/ryzom_ams/www/is_installed
|
code/web/docs/ams/html
|
||||||
|
code/web/public_php/ams/templates_c
|
||||||
|
code/ryzom/tools/server/ryzom_ams/drupal
|
||||||
|
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/autoload
|
||||||
|
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/configs
|
||||||
|
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/cron
|
||||||
|
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/img
|
||||||
|
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/plugins
|
||||||
|
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/smarty
|
||||||
|
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/translations
|
||||||
|
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/libinclude.php
|
||||||
|
code/ryzom/tools/server/ryzom_ams/old
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#tools and external dir's
|
#tools and external dir's
|
||||||
external
|
external
|
||||||
|
|
|
@ -197,6 +197,10 @@ IF(WITH_TOOLS)
|
||||||
ADD_SUBDIRECTORY(tool)
|
ADD_SUBDIRECTORY(tool)
|
||||||
ENDIF(WITH_TOOLS)
|
ENDIF(WITH_TOOLS)
|
||||||
|
|
||||||
|
IF(WITH_STUDIO)
|
||||||
|
ADD_SUBDIRECTORY(studio)
|
||||||
|
ENDIF(WITH_STUDIO)
|
||||||
|
|
||||||
# To build the documention, you will have to enable it
|
# To build the documention, you will have to enable it
|
||||||
# and then do the equivalent of "make DoxygenDoc".
|
# and then do the equivalent of "make DoxygenDoc".
|
||||||
IF(BUILD_DOCUMENTATION)
|
IF(BUILD_DOCUMENTATION)
|
||||||
|
|
|
@ -229,6 +229,10 @@ Remove the CMakeCache.txt file and try again from another folder, e.g.:
|
||||||
ENDMACRO(CHECK_OUT_OF_SOURCE)
|
ENDMACRO(CHECK_OUT_OF_SOURCE)
|
||||||
|
|
||||||
MACRO(NL_SETUP_DEFAULT_OPTIONS)
|
MACRO(NL_SETUP_DEFAULT_OPTIONS)
|
||||||
|
IF(WITH_QT)
|
||||||
|
OPTION(WITH_STUDIO "Build Core Studio" OFF )
|
||||||
|
ENDIF(WITH_QT)
|
||||||
|
|
||||||
###
|
###
|
||||||
# Features
|
# Features
|
||||||
###
|
###
|
||||||
|
|
|
@ -86,6 +86,11 @@ public:
|
||||||
_BitmapName[bitmapType]=name;
|
_BitmapName[bitmapType]=name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string getFileName (TBitmap bitmapType) const
|
||||||
|
{
|
||||||
|
return _BitmapName[bitmapType];
|
||||||
|
}
|
||||||
|
|
||||||
/// Get the additional orientation (CCW) for alpha texture.
|
/// Get the additional orientation (CCW) for alpha texture.
|
||||||
uint8 getRotAlpha ()
|
uint8 getRotAlpha ()
|
||||||
{
|
{
|
||||||
|
@ -161,6 +166,9 @@ public:
|
||||||
{
|
{
|
||||||
return _Name;
|
return _Name;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
std::set<std::string> getTileSets() const{ return _TileSet; }
|
||||||
|
|
||||||
void setName (const std::string& name);
|
void setName (const std::string& name);
|
||||||
void addTileSet (const std::string& name);
|
void addTileSet (const std::string& name);
|
||||||
void removeTileSet (const std::string& name);
|
void removeTileSet (const std::string& name);
|
||||||
|
@ -169,6 +177,8 @@ public:
|
||||||
return _TileSet.find (name)!=_TileSet.end();
|
return _TileSet.find (name)!=_TileSet.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void clear(){ _TileSet.clear(); }
|
||||||
|
|
||||||
void serial(class NLMISC::IStream &f) throw(NLMISC::EStream);
|
void serial(class NLMISC::IStream &f) throw(NLMISC::EStream);
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -68,6 +68,8 @@ namespace NLGUI
|
||||||
return _GlobalInstance;
|
return _GlobalInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void getActionHandlers( std::vector< std::string > &handlers );
|
||||||
|
|
||||||
/// return pointer to action handler or null if it doesn't exist
|
/// return pointer to action handler or null if it doesn't exist
|
||||||
IActionHandler *getActionHandler(const std::string &name) const
|
IActionHandler *getActionHandler(const std::string &name) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -171,7 +171,9 @@ namespace NLGUI
|
||||||
THotSpot _ToolTipPosRefAlt : 6;
|
THotSpot _ToolTipPosRefAlt : 6;
|
||||||
protected:
|
protected:
|
||||||
void convertTooltipHotSpot(const char *prop, THotSpot &parentHS, THotSpot &childHS);
|
void convertTooltipHotSpot(const char *prop, THotSpot &parentHS, THotSpot &childHS);
|
||||||
|
void convertTooltipHotSpot(const char *prop, THotSpot &HS );
|
||||||
static std::string TooltipHotSpotToString( THotSpot parent, THotSpot child );
|
static std::string TooltipHotSpotToString( THotSpot parent, THotSpot child );
|
||||||
|
static std::string TooltipHotSpotToString( THotSpot HS );
|
||||||
|
|
||||||
void mapAHString( const std::string &key, const std::string &value );
|
void mapAHString( const std::string &key, const std::string &value );
|
||||||
std::string getAHString( const std::string &key ) const;
|
std::string getAHString( const std::string &key ) const;
|
||||||
|
|
|
@ -286,6 +286,12 @@ namespace NLGUI
|
||||||
*/
|
*/
|
||||||
void flush ();
|
void flush ();
|
||||||
|
|
||||||
|
/// Retrives a texture
|
||||||
|
bool getTexture( NLMISC::CBitmap &bm, const std::string &name );
|
||||||
|
|
||||||
|
/// Retrieve the texture names
|
||||||
|
void getTextureNames( std::vector< std::string > &textures );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get a texture file pointer from a string name. O(logN)
|
* get a texture file pointer from a string name. O(logN)
|
||||||
* \param id : the id of the texture
|
* \param id : the id of the texture
|
||||||
|
|
|
@ -232,6 +232,9 @@ private:
|
||||||
|
|
||||||
// If not NULL, binary mode detected, use this stream in serials
|
// If not NULL, binary mode detected, use this stream in serials
|
||||||
IStream *_BinaryStream;
|
IStream *_BinaryStream;
|
||||||
|
|
||||||
|
// System dependant structure for locale
|
||||||
|
void* _Locale;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -178,6 +178,9 @@ private:
|
||||||
|
|
||||||
// Error message
|
// Error message
|
||||||
std::string _ErrorString;
|
std::string _ErrorString;
|
||||||
|
|
||||||
|
// System dependant structure for locale
|
||||||
|
void* _Locale;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -200,6 +200,10 @@ public:
|
||||||
*/
|
*/
|
||||||
void getFileListByName(const std::string &extension, const std::string &name, std::vector<std::string> &filenames);
|
void getFileListByName(const std::string &extension, const std::string &name, std::vector<std::string> &filenames);
|
||||||
|
|
||||||
|
/** Create a list of file having the requested string in the path and the requested extension.
|
||||||
|
*/
|
||||||
|
void getFileListByPath(const std::string &extension, const std::string &path, std::vector<std::string> &filenames);
|
||||||
|
|
||||||
/** Make a path relative to another if possible, else doesn't change it.
|
/** Make a path relative to another if possible, else doesn't change it.
|
||||||
* \param basePath is the base path to be relative to.
|
* \param basePath is the base path to be relative to.
|
||||||
* \param relativePath is the path to make relative to basePath.
|
* \param relativePath is the path to make relative to basePath.
|
||||||
|
@ -492,6 +496,10 @@ public:
|
||||||
*/
|
*/
|
||||||
static void getFileListByName(const std::string &extension, const std::string &name, std::vector<std::string> &filenames);
|
static void getFileListByName(const std::string &extension, const std::string &name, std::vector<std::string> &filenames);
|
||||||
|
|
||||||
|
/** Create a list of file having the requested string in the path and the requested extension
|
||||||
|
*/
|
||||||
|
static void getFileListByPath(const std::string &extension, const std::string &path, std::vector<std::string> &filenames);
|
||||||
|
|
||||||
/** Make a path relative to another if possible, else doesn't change it.
|
/** Make a path relative to another if possible, else doesn't change it.
|
||||||
* \param basePath is the base path to be relative to.
|
* \param basePath is the base path to be relative to.
|
||||||
* \param relativePath is the path to make relative to basePath.
|
* \param relativePath is the path to make relative to basePath.
|
||||||
|
|
|
@ -2803,11 +2803,15 @@ IOcclusionQuery::TOcclusionType COcclusionQueryGL::getOcclusionType()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GLuint result;
|
GLuint result;
|
||||||
|
nglGetQueryObjectuivARB(ID, GL_QUERY_RESULT_AVAILABLE, &result);
|
||||||
|
if (result != GL_FALSE)
|
||||||
|
{
|
||||||
nglGetQueryObjectuivARB(ID, GL_QUERY_RESULT, &result);
|
nglGetQueryObjectuivARB(ID, GL_QUERY_RESULT, &result);
|
||||||
OcclusionType = result != 0 ? NotOccluded : Occluded;
|
OcclusionType = result != 0 ? NotOccluded : Occluded;
|
||||||
VisibleCount = (uint) result;
|
VisibleCount = (uint) result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
return OcclusionType;
|
return OcclusionType;
|
||||||
}
|
}
|
||||||
|
|
|
@ -408,6 +408,12 @@ void CInstanceLighter::light (const CInstanceGroup &igIn, CInstanceGroup &igOut,
|
||||||
string name= _Instances[i].Name;
|
string name= _Instances[i].Name;
|
||||||
bool shapeFound= true;
|
bool shapeFound= true;
|
||||||
|
|
||||||
|
if (toLower (CFile::getExtension (name)) == "pacs_prim")
|
||||||
|
{
|
||||||
|
nlwarning("EXPORT BUG: Can't read %s (not a shape), should not be part of .ig!", name.c_str());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Try to find the shape in the UseShapeMap.
|
// Try to find the shape in the UseShapeMap.
|
||||||
std::map<string, IShape*>::const_iterator iteMap= lightDesc.UserShapeMap.find (name);
|
std::map<string, IShape*>::const_iterator iteMap= lightDesc.UserShapeMap.find (name);
|
||||||
|
|
||||||
|
|
|
@ -111,6 +111,18 @@ namespace NLGUI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CAHManager::getActionHandlers( std::vector< std::string > &handlers )
|
||||||
|
{
|
||||||
|
handlers.clear();
|
||||||
|
|
||||||
|
std::map< string, IActionHandler* >::iterator itr = FactoryMap.begin();
|
||||||
|
while( itr != FactoryMap.end() )
|
||||||
|
{
|
||||||
|
handlers.push_back( itr->first );
|
||||||
|
++itr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
IActionHandler* CAHManager::getAH(const std::string &name, std::string ¶ms)
|
IActionHandler* CAHManager::getAH(const std::string &name, std::string ¶ms)
|
||||||
{
|
{
|
||||||
|
|
|
@ -86,7 +86,7 @@ namespace NLGUI
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return "control";
|
||||||
}
|
}
|
||||||
|
|
||||||
CCtrlBase::TToolTipParentType CCtrlBase::stringToToolTipParent( const std::string &str )
|
CCtrlBase::TToolTipParentType CCtrlBase::stringToToolTipParent( const std::string &str )
|
||||||
|
@ -220,28 +220,22 @@ namespace NLGUI
|
||||||
else
|
else
|
||||||
if( name == "tooltip_posref" )
|
if( name == "tooltip_posref" )
|
||||||
{
|
{
|
||||||
std::string s;
|
return TooltipHotSpotToString( _ToolTipPosRef );
|
||||||
if( ( _ToolTipParentPosRef == Hotspot_TTAuto ) && ( _ToolTipPosRef == Hotspot_TTAuto ) )
|
|
||||||
return "auto";
|
|
||||||
else{
|
|
||||||
s = CInterfaceElement::HotSpotToString( _ToolTipParentPosRef );
|
|
||||||
s += " ";
|
|
||||||
s += CInterfaceElement::HotSpotToString( _ToolTipPosRef );
|
|
||||||
return s;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
if( name == "tooltip_parent_posref" )
|
||||||
|
{
|
||||||
|
return TooltipHotSpotToString( _ToolTipParentPosRef );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if( name == "tooltip_posref_alt" )
|
if( name == "tooltip_posref_alt" )
|
||||||
{
|
{
|
||||||
std::string s;
|
return TooltipHotSpotToString( _ToolTipPosRefAlt );
|
||||||
if( ( _ToolTipParentPosRefAlt == Hotspot_TTAuto ) && ( _ToolTipPosRefAlt == Hotspot_TTAuto ) )
|
|
||||||
return "auto";
|
|
||||||
else{
|
|
||||||
s = CInterfaceElement::HotSpotToString( _ToolTipParentPosRefAlt );
|
|
||||||
s += " ";
|
|
||||||
s += CInterfaceElement::HotSpotToString( _ToolTipPosRefAlt );
|
|
||||||
return s;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
if( name == "tooltip_parent_posref_alt" )
|
||||||
|
{
|
||||||
|
return TooltipHotSpotToString( _ToolTipParentPosRefAlt );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if( name == "instant_help" )
|
if( name == "instant_help" )
|
||||||
|
@ -293,21 +287,65 @@ namespace NLGUI
|
||||||
else
|
else
|
||||||
if( name == "tooltip_posref" )
|
if( name == "tooltip_posref" )
|
||||||
{
|
{
|
||||||
THotSpot parentHS;
|
|
||||||
THotSpot HS;
|
THotSpot HS;
|
||||||
convertTooltipHotSpot( value.c_str(), parentHS, HS );
|
convertTooltipHotSpot( value.c_str(), HS );
|
||||||
_ToolTipParentPosRef = parentHS;
|
|
||||||
_ToolTipPosRef = HS;
|
_ToolTipPosRef = HS;
|
||||||
|
|
||||||
|
// When auto is set, both of them need to be auto
|
||||||
|
if( _ToolTipPosRef == Hotspot_TTAuto )
|
||||||
|
_ToolTipParentPosRef = Hotspot_TTAuto;
|
||||||
|
else
|
||||||
|
if( _ToolTipParentPosRef == Hotspot_TTAuto )
|
||||||
|
_ToolTipParentPosRef = _ToolTipPosRef;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if( name == "tooltip_parent_posref" )
|
||||||
|
{
|
||||||
|
THotSpot HS;
|
||||||
|
convertTooltipHotSpot( value.c_str(), HS );
|
||||||
|
_ToolTipParentPosRef = HS;
|
||||||
|
|
||||||
|
// When auto is set, both of them need to be auto
|
||||||
|
if( _ToolTipParentPosRef == Hotspot_TTAuto )
|
||||||
|
_ToolTipPosRef = Hotspot_TTAuto;
|
||||||
|
else
|
||||||
|
if( _ToolTipPosRef == Hotspot_TTAuto )
|
||||||
|
_ToolTipPosRef = _ToolTipParentPosRef;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if( name == "tooltip_posref_alt" )
|
if( name == "tooltip_posref_alt" )
|
||||||
{
|
{
|
||||||
THotSpot parentHS;
|
|
||||||
THotSpot HS;
|
THotSpot HS;
|
||||||
convertTooltipHotSpot( value.c_str(), parentHS, HS );
|
convertTooltipHotSpot( value.c_str(), HS );
|
||||||
_ToolTipParentPosRefAlt = parentHS;
|
|
||||||
_ToolTipPosRefAlt = HS;
|
_ToolTipPosRefAlt = HS;
|
||||||
|
|
||||||
|
// When auto is set, both of them need to be auto
|
||||||
|
if( _ToolTipPosRefAlt == Hotspot_TTAuto )
|
||||||
|
_ToolTipParentPosRefAlt = Hotspot_TTAuto;
|
||||||
|
else
|
||||||
|
if( _ToolTipParentPosRefAlt == Hotspot_TTAuto )
|
||||||
|
_ToolTipPosRefAlt = _ToolTipParentPosRefAlt;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if( name == "tooltip_parent_posref_alt" )
|
||||||
|
{
|
||||||
|
THotSpot HS;
|
||||||
|
convertTooltipHotSpot( value.c_str(), HS );
|
||||||
|
_ToolTipParentPosRefAlt = HS;
|
||||||
|
|
||||||
|
// When auto is set, both of them need to be auto
|
||||||
|
if( _ToolTipParentPosRefAlt == Hotspot_TTAuto )
|
||||||
|
_ToolTipPosRefAlt = Hotspot_TTAuto;
|
||||||
|
else
|
||||||
|
if( _ToolTipPosRefAlt == Hotspot_TTAuto )
|
||||||
|
_ToolTipPosRefAlt = _ToolTipParentPosRefAlt;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -374,6 +412,21 @@ namespace NLGUI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CCtrlBase::convertTooltipHotSpot(const char *prop, THotSpot &HS )
|
||||||
|
{
|
||||||
|
if(prop)
|
||||||
|
{
|
||||||
|
const char *ptr = (const char*)prop;
|
||||||
|
if(stricmp(ptr, "auto")==0)
|
||||||
|
{
|
||||||
|
HS = Hotspot_TTAuto;
|
||||||
|
}
|
||||||
|
else if(strlen(ptr)==2)
|
||||||
|
{
|
||||||
|
HS = convertHotSpot(ptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::string CCtrlBase::TooltipHotSpotToString( THotSpot parent, THotSpot child )
|
std::string CCtrlBase::TooltipHotSpotToString( THotSpot parent, THotSpot child )
|
||||||
{
|
{
|
||||||
|
@ -393,6 +446,20 @@ namespace NLGUI
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string CCtrlBase::TooltipHotSpotToString( THotSpot HS )
|
||||||
|
{
|
||||||
|
std::string s;
|
||||||
|
if( HS == Hotspot_TTAuto )
|
||||||
|
{
|
||||||
|
s = "auto";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
s = HotSpotToString( HS );
|
||||||
|
}
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
bool CCtrlBase::emptyContextHelp() const
|
bool CCtrlBase::emptyContextHelp() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -149,11 +149,16 @@ namespace NLGUI
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if( name == "text_posref" )
|
if( name == "text_posref" )
|
||||||
|
{
|
||||||
|
std::string pr;
|
||||||
|
pr = CInterfaceElement::HotSpotToString( _TextPosRef );
|
||||||
|
return pr;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if( name == "text_parent_posref" )
|
||||||
{
|
{
|
||||||
std::string pr;
|
std::string pr;
|
||||||
pr = CInterfaceElement::HotSpotToString( _TextParentPosRef );
|
pr = CInterfaceElement::HotSpotToString( _TextParentPosRef );
|
||||||
pr += " ";
|
|
||||||
pr += CInterfaceElement::HotSpotToString( _TextPosRef );
|
|
||||||
return pr;
|
return pr;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -324,10 +329,13 @@ namespace NLGUI
|
||||||
else
|
else
|
||||||
if( name == "text_posref" )
|
if( name == "text_posref" )
|
||||||
{
|
{
|
||||||
THotSpot parent, posref;
|
_TextPosRef = convertHotSpot( value.c_str() );
|
||||||
CInterfaceElement::convertHotSpotCouple( value.c_str(), parent, posref );
|
return;
|
||||||
_TextPosRef = posref;
|
}
|
||||||
_TextParentPosRef = parent;
|
else
|
||||||
|
if( name == "text_parent_posref" )
|
||||||
|
{
|
||||||
|
_TextParentPosRef = convertHotSpot( value.c_str() );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -209,6 +209,8 @@ namespace NLGUI
|
||||||
}
|
}
|
||||||
|
|
||||||
nlassert(false);
|
nlassert(false);
|
||||||
|
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if( name == "align" )
|
if( name == "align" )
|
||||||
|
@ -229,6 +231,8 @@ namespace NLGUI
|
||||||
}
|
}
|
||||||
|
|
||||||
nlassert(false);
|
nlassert(false);
|
||||||
|
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if( name == "space" )
|
if( name == "space" )
|
||||||
|
|
|
@ -89,6 +89,8 @@ namespace NLGUI
|
||||||
}
|
}
|
||||||
|
|
||||||
nlassert(false);
|
nlassert(false);
|
||||||
|
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if( name == "valign" )
|
if( name == "valign" )
|
||||||
|
@ -106,6 +108,8 @@ namespace NLGUI
|
||||||
}
|
}
|
||||||
|
|
||||||
nlassert(false);
|
nlassert(false);
|
||||||
|
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if( name == "left_margin" )
|
if( name == "left_margin" )
|
||||||
|
|
|
@ -24,6 +24,8 @@ NLMISC_REGISTER_OBJECT(CViewBase, CInterfaceGroupWheel, std::string, "group_whee
|
||||||
namespace NLGUI
|
namespace NLGUI
|
||||||
{
|
{
|
||||||
|
|
||||||
|
void force_link_group_wheel_cpp() { }
|
||||||
|
|
||||||
// *****************************************************************************************************************
|
// *****************************************************************************************************************
|
||||||
CInterfaceGroupWheel::CInterfaceGroupWheel(const TCtorParam ¶m) : CInterfaceGroup(param)
|
CInterfaceGroupWheel::CInterfaceGroupWheel(const TCtorParam ¶m) : CInterfaceGroup(param)
|
||||||
{
|
{
|
||||||
|
|
|
@ -130,12 +130,17 @@ namespace NLGUI
|
||||||
if( name == "posref" )
|
if( name == "posref" )
|
||||||
{
|
{
|
||||||
std::string posref;
|
std::string posref;
|
||||||
posref = HotSpotToString( getParentPosRef() );
|
|
||||||
posref += " ";
|
|
||||||
posref += HotSpotToString( getPosRef() );
|
posref += HotSpotToString( getPosRef() );
|
||||||
return posref;
|
return posref;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
if( name == "parentposref" )
|
||||||
|
{
|
||||||
|
std::string parentPosRef;
|
||||||
|
parentPosRef = HotSpotToString( getParentPosRef() );
|
||||||
|
return parentPosRef;
|
||||||
|
}
|
||||||
|
else
|
||||||
if( name == "sizeref" )
|
if( name == "sizeref" )
|
||||||
{
|
{
|
||||||
return getSizeRefAsString( _SizeRef, _SizeDivW, _SizeDivH );
|
return getSizeRefAsString( _SizeRef, _SizeDivW, _SizeDivH );
|
||||||
|
@ -221,10 +226,15 @@ namespace NLGUI
|
||||||
else
|
else
|
||||||
if( name == "posref" )
|
if( name == "posref" )
|
||||||
{
|
{
|
||||||
convertHotSpotCouple( value.c_str(), _ParentPosRef, _PosRef );
|
convertHotSpot( value.c_str() );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
if( name == "parentposref" )
|
||||||
|
{
|
||||||
|
convertHotSpot( value.c_str() );
|
||||||
|
}
|
||||||
|
else
|
||||||
if( name == "sizeref" )
|
if( name == "sizeref" )
|
||||||
{
|
{
|
||||||
parseSizeRef( value.c_str() );
|
parseSizeRef( value.c_str() );
|
||||||
|
|
|
@ -26,6 +26,7 @@ namespace NLGUI
|
||||||
void ifexprufct_forcelink();
|
void ifexprufct_forcelink();
|
||||||
void force_link_dbgroup_select_number_cpp();
|
void force_link_dbgroup_select_number_cpp();
|
||||||
void force_link_dbgroup_combo_box_cpp();
|
void force_link_dbgroup_combo_box_cpp();
|
||||||
|
void force_link_group_wheel_cpp();
|
||||||
|
|
||||||
/// Necessary so the linker doesn't drop the code of these classes from the library
|
/// Necessary so the linker doesn't drop the code of these classes from the library
|
||||||
void LinkHack()
|
void LinkHack()
|
||||||
|
@ -37,5 +38,6 @@ namespace NLGUI
|
||||||
ifexprufct_forcelink();
|
ifexprufct_forcelink();
|
||||||
force_link_dbgroup_select_number_cpp();
|
force_link_dbgroup_select_number_cpp();
|
||||||
force_link_dbgroup_combo_box_cpp();
|
force_link_dbgroup_combo_box_cpp();
|
||||||
|
force_link_group_wheel_cpp();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1064,6 +1064,46 @@ namespace NLGUI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CViewRenderer::getTexture( NLMISC::CBitmap &bm, const std::string &name )
|
||||||
|
{
|
||||||
|
TTextureMap::const_iterator itr = _TextureMap.find( name );
|
||||||
|
if( itr == _TextureMap.end() )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
sint32 id = itr->second;
|
||||||
|
SImage *si = getSImage( id );
|
||||||
|
NLMISC::CBitmap *src = si->GlobalTexturePtr->Texture->generateDatas();
|
||||||
|
|
||||||
|
if( src->getPixelFormat() != NLMISC::CBitmap::RGBA )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
uint x0 = (uint)( si->UVMin.U * si->GlobalTexturePtr->Width );
|
||||||
|
uint y0 = (uint)( si->UVMin.V * si->GlobalTexturePtr->Height );
|
||||||
|
uint x1 = (uint)( si->UVMax.U * si->GlobalTexturePtr->Width );
|
||||||
|
uint y1 = (uint)( si->UVMax.V * si->GlobalTexturePtr->Height );
|
||||||
|
|
||||||
|
if( x1 == x0 )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if( y1 == y0 )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
bm.resize( x1 - x0, y1 - y0 );
|
||||||
|
bm.blit( *src, x0, y0, ( x1 - x0 ), ( y1 - y0 ), 0, 0 );
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CViewRenderer::getTextureNames( std::vector< std::string > &textures )
|
||||||
|
{
|
||||||
|
TTextureMap::const_iterator itr = _TextureMap.begin();
|
||||||
|
while( itr != _TextureMap.end() )
|
||||||
|
{
|
||||||
|
textures.push_back( itr->first );
|
||||||
|
++itr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* getTextureIdFromName
|
* getTextureIdFromName
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -24,6 +24,11 @@
|
||||||
// Include from libxml2
|
// Include from libxml2
|
||||||
#include <libxml/xmlerror.h>
|
#include <libxml/xmlerror.h>
|
||||||
|
|
||||||
|
#if defined(NL_OS_WINDOWS) && defined(NL_COMP_VC_VERSION) && NL_COMP_VC_VERSION >= 80
|
||||||
|
#define USE_LOCALE_ATOF
|
||||||
|
#include <locale.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
#define NLMISC_READ_BUFFER_SIZE 1024
|
#define NLMISC_READ_BUFFER_SIZE 1024
|
||||||
|
@ -46,6 +51,22 @@ const char SEPARATOR = ' ';
|
||||||
serialSeparatedBufferIn( number_as_string ); \
|
serialSeparatedBufferIn( number_as_string ); \
|
||||||
dest = (thetype)convfunc( number_as_string.c_str() );
|
dest = (thetype)convfunc( number_as_string.c_str() );
|
||||||
|
|
||||||
|
#ifdef USE_LOCALE_ATOF
|
||||||
|
|
||||||
|
#define readnumberlocale(dest,thetype,digits,convfunc) \
|
||||||
|
string number_as_string; \
|
||||||
|
serialSeparatedBufferIn( number_as_string ); \
|
||||||
|
dest = (thetype)convfunc( number_as_string.c_str(), (_locale_t)_Locale );
|
||||||
|
|
||||||
|
#define nl_atof _atof_l
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#define readnumberlocale(dest,thetype,digits,convfunc) readnumber(dest,thetype,digits,convfunc)
|
||||||
|
#define nl_atof atof
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
|
|
||||||
inline void CIXml::flushContentString ()
|
inline void CIXml::flushContentString ()
|
||||||
|
@ -70,6 +91,13 @@ CIXml::CIXml () : IStream (true /* Input mode */)
|
||||||
_ErrorString = "";
|
_ErrorString = "";
|
||||||
_TryBinaryMode = false;
|
_TryBinaryMode = false;
|
||||||
_BinaryStream = NULL;
|
_BinaryStream = NULL;
|
||||||
|
|
||||||
|
#ifdef USE_LOCALE_ATOF
|
||||||
|
// create C numeric locale
|
||||||
|
_Locale = _create_locale(LC_NUMERIC, "C");
|
||||||
|
#else
|
||||||
|
_Locale = NULL;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
|
@ -85,6 +113,13 @@ CIXml::CIXml (bool tryBinaryMode) : IStream (true /* Input mode */)
|
||||||
_ErrorString = "";
|
_ErrorString = "";
|
||||||
_TryBinaryMode = tryBinaryMode;
|
_TryBinaryMode = tryBinaryMode;
|
||||||
_BinaryStream = NULL;
|
_BinaryStream = NULL;
|
||||||
|
|
||||||
|
#ifdef USE_LOCALE_ATOF
|
||||||
|
// create C numeric locale
|
||||||
|
_Locale = _create_locale(LC_NUMERIC, "C");
|
||||||
|
#else
|
||||||
|
_Locale = NULL;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
|
@ -93,6 +128,10 @@ CIXml::~CIXml ()
|
||||||
{
|
{
|
||||||
// Release
|
// Release
|
||||||
release ();
|
release ();
|
||||||
|
|
||||||
|
#ifdef USE_LOCALE_ATOF
|
||||||
|
if (_Locale) _free_locale((_locale_t)_Locale);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
|
@ -546,7 +585,7 @@ void CIXml::serial(float &b)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
readnumber( b, float, 128, atof );
|
readnumberlocale( b, float, 128, nl_atof );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -560,7 +599,7 @@ void CIXml::serial(double &b)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
readnumber( b, double, 128, atof );
|
readnumberlocale( b, double, 128, nl_atof );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,11 @@
|
||||||
// Include from libxml2
|
// Include from libxml2
|
||||||
#include <libxml/xmlerror.h>
|
#include <libxml/xmlerror.h>
|
||||||
|
|
||||||
|
#if defined(NL_OS_WINDOWS) && defined(NL_COMP_VC_VERSION) && NL_COMP_VC_VERSION >= 80
|
||||||
|
#define USE_LOCALE_SPRINTF
|
||||||
|
#include <locale.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
#ifdef DEBUG_NEW
|
#ifdef DEBUG_NEW
|
||||||
|
@ -38,11 +43,22 @@ const char SEPARATOR = ' ';
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
|
|
||||||
|
#ifdef USE_LOCALE_SPRINTF
|
||||||
|
|
||||||
|
#define writenumber(src,format,digits) \
|
||||||
|
char number_as_cstring [digits+1]; \
|
||||||
|
_sprintf_l( number_as_cstring, format, (_locale_t)_Locale, src ); \
|
||||||
|
serialSeparatedBufferOut( number_as_cstring );
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
#define writenumber(src,format,digits) \
|
#define writenumber(src,format,digits) \
|
||||||
char number_as_cstring [digits+1]; \
|
char number_as_cstring [digits+1]; \
|
||||||
sprintf( number_as_cstring, format, src ); \
|
sprintf( number_as_cstring, format, src ); \
|
||||||
serialSeparatedBufferOut( number_as_cstring );
|
serialSeparatedBufferOut( number_as_cstring );
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
// XML callbacks
|
// XML callbacks
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
|
@ -133,6 +149,13 @@ COXml::COXml () : IStream (false /* Output mode */)
|
||||||
|
|
||||||
// Push begin
|
// Push begin
|
||||||
_PushBegin = false;
|
_PushBegin = false;
|
||||||
|
|
||||||
|
#ifdef USE_LOCALE_SPRINTF
|
||||||
|
// create C numeric locale
|
||||||
|
_Locale = _create_locale(LC_NUMERIC, "C");
|
||||||
|
#else
|
||||||
|
_Locale = NULL;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
|
@ -192,6 +215,10 @@ COXml::~COXml ()
|
||||||
{
|
{
|
||||||
// Flush document to the internal stream
|
// Flush document to the internal stream
|
||||||
flush ();
|
flush ();
|
||||||
|
|
||||||
|
#ifdef USE_LOCALE_SPRINTF
|
||||||
|
if (_Locale) _free_locale((_locale_t)_Locale);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
|
|
|
@ -221,6 +221,67 @@ void CFileContainer::getFileListByName(const std::string &extension, const std::
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CPath::getFileListByPath(const std::string &extension, const std::string &path, std::vector<std::string> &filenames)
|
||||||
|
{
|
||||||
|
getInstance()->_FileContainer.getFileListByPath(extension, path, filenames);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFileContainer::getFileListByPath(const std::string &extension, const std::string &path, std::vector<std::string> &filenames)
|
||||||
|
{
|
||||||
|
if (!_MemoryCompressed)
|
||||||
|
{
|
||||||
|
TFiles::iterator first(_Files.begin()), last(_Files.end());
|
||||||
|
|
||||||
|
if( !path.empty() )
|
||||||
|
{
|
||||||
|
for (; first != last; ++ first)
|
||||||
|
{
|
||||||
|
string ext = SSMext.get(first->second.idExt);
|
||||||
|
string p = SSMpath.get(first->second.idPath);
|
||||||
|
if (p.find(path) != string::npos && (ext == extension || extension.empty()))
|
||||||
|
{
|
||||||
|
filenames.push_back(first->first);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// if extension is empty we keep all files
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (; first != last; ++ first)
|
||||||
|
{
|
||||||
|
filenames.push_back(first->first);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// compressed memory version
|
||||||
|
std::vector<CFileContainer::CMCFileEntry>::iterator first(_MCFiles.begin()), last(_MCFiles.end());
|
||||||
|
|
||||||
|
if( !path.empty() )
|
||||||
|
{
|
||||||
|
for (; first != last; ++ first)
|
||||||
|
{
|
||||||
|
string ext = SSMext.get(first->idExt);
|
||||||
|
string p = SSMpath.get(first->idPath);
|
||||||
|
|
||||||
|
if (strstr(p.c_str(), path.c_str()) != NULL && (ext == extension || extension.empty()))
|
||||||
|
{
|
||||||
|
filenames.push_back(first->Name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// if extension is empty we keep all files
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (; first != last; ++ first)
|
||||||
|
{
|
||||||
|
filenames.push_back(first->Name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CPath::clearMap ()
|
void CPath::clearMap ()
|
||||||
{
|
{
|
||||||
getInstance()->_FileContainer.clearMap();
|
getInstance()->_FileContainer.clearMap();
|
||||||
|
|
|
@ -1,40 +1,42 @@
|
||||||
|
|
||||||
IF(WITH_NEL_TOOLS)
|
IF(WITH_NEL_TOOLS)
|
||||||
|
IF(WITH_3D)
|
||||||
SUBDIRS(
|
SUBDIRS(
|
||||||
|
anim_builder
|
||||||
|
animation_set_builder
|
||||||
|
build_clod_bank
|
||||||
|
build_clodtex
|
||||||
build_coarse_mesh
|
build_coarse_mesh
|
||||||
build_far_bank
|
build_far_bank
|
||||||
|
build_shadow_skin
|
||||||
build_smallbank
|
build_smallbank
|
||||||
ig_lighter
|
cluster_viewer
|
||||||
|
file_info
|
||||||
|
ig_add
|
||||||
ig_elevation
|
ig_elevation
|
||||||
|
ig_info
|
||||||
|
ig_lighter
|
||||||
lightmap_optimizer
|
lightmap_optimizer
|
||||||
zone_dependencies
|
zone_dependencies
|
||||||
zone_ig_lighter
|
zone_ig_lighter
|
||||||
zone_lighter
|
zone_lighter
|
||||||
zone_welder
|
zone_welder
|
||||||
animation_set_builder
|
|
||||||
anim_builder
|
|
||||||
build_clod_bank
|
|
||||||
build_clodtex
|
|
||||||
build_interface
|
|
||||||
build_shadow_skin
|
|
||||||
cluster_viewer
|
|
||||||
file_info
|
|
||||||
get_neighbors
|
|
||||||
ig_add
|
|
||||||
ig_info
|
|
||||||
shapes_exporter
|
shapes_exporter
|
||||||
tga_cut
|
|
||||||
tga_resize
|
|
||||||
shape2obj
|
shape2obj
|
||||||
zone_check_bind
|
zone_check_bind
|
||||||
zone_dump
|
zone_dump
|
||||||
zviewer)
|
zviewer)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
ENDIF(WITH_NEL_TOOLS)
|
SUBDIRS(
|
||||||
|
build_interface
|
||||||
|
get_neighbors
|
||||||
|
tga_cut
|
||||||
|
tga_resize)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
# For tools selection of only max plugins
|
# For tools selection of only max plugins
|
||||||
IF(WIN32)
|
IF(WIN32 AND WITH_3D)
|
||||||
IF(MFC_FOUND)
|
IF(MFC_FOUND)
|
||||||
ADD_SUBDIRECTORY(object_viewer)
|
ADD_SUBDIRECTORY(object_viewer)
|
||||||
IF(WITH_NEL_MAXPLUGIN)
|
IF(WITH_NEL_MAXPLUGIN)
|
||||||
|
@ -44,9 +46,9 @@ IF(WIN32)
|
||||||
ENDIF(MAXSDK_FOUND)
|
ENDIF(MAXSDK_FOUND)
|
||||||
ENDIF(WITH_NEL_MAXPLUGIN)
|
ENDIF(WITH_NEL_MAXPLUGIN)
|
||||||
ENDIF(MFC_FOUND)
|
ENDIF(MFC_FOUND)
|
||||||
ENDIF(WIN32)
|
ENDIF()
|
||||||
|
|
||||||
IF(WITH_NEL_TOOLS)
|
IF(WITH_NEL_TOOLS AND WITH_3D)
|
||||||
IF(WIN32)
|
IF(WIN32)
|
||||||
# ADD_SUBDIRECTORY(lightmap_optimizer)
|
# ADD_SUBDIRECTORY(lightmap_optimizer)
|
||||||
IF(MFC_FOUND)
|
IF(MFC_FOUND)
|
||||||
|
@ -57,7 +59,6 @@ IF(WITH_NEL_TOOLS)
|
||||||
|
|
||||||
IF(WITH_QT)
|
IF(WITH_QT)
|
||||||
ADD_SUBDIRECTORY(tile_edit_qt)
|
ADD_SUBDIRECTORY(tile_edit_qt)
|
||||||
ADD_SUBDIRECTORY(object_viewer_qt)
|
|
||||||
ADD_SUBDIRECTORY(object_viewer_widget)
|
ADD_SUBDIRECTORY(object_viewer_widget)
|
||||||
ENDIF(WITH_QT)
|
ENDIF(WITH_QT)
|
||||||
|
|
||||||
|
@ -71,5 +72,5 @@ IF(WITH_NEL_TOOLS)
|
||||||
#crash_log_analyser
|
#crash_log_analyser
|
||||||
#shapes_exporter
|
#shapes_exporter
|
||||||
|
|
||||||
ENDIF(WITH_NEL_TOOLS)
|
ENDIF()
|
||||||
|
|
||||||
|
|
|
@ -113,18 +113,17 @@ void putPixel(uint8 *dst, uint8 *src, bool alphaTransfert)
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
bool putIn (NLMISC::CBitmap *pSrc, NLMISC::CBitmap *pDst, sint32 x, sint32 y, bool alphaTransfert=true)
|
bool putIn (NLMISC::CBitmap *pSrc, NLMISC::CBitmap *pDst, sint32 x, sint32 y, bool alphaTransfert=true)
|
||||||
{
|
{
|
||||||
uint32 a, b;
|
|
||||||
|
|
||||||
uint8 *rSrcPix = &pSrc->getPixels()[0];
|
uint8 *rSrcPix = &pSrc->getPixels()[0];
|
||||||
uint8 *rDstPix = &pDst->getPixels()[0];
|
uint8 *rDstPix = &pDst->getPixels()[0];
|
||||||
|
|
||||||
uint wSrc= pSrc->getWidth();
|
uint wSrc= pSrc->getWidth();
|
||||||
uint hSrc= pSrc->getHeight();
|
uint hSrc= pSrc->getHeight();
|
||||||
for (b = 0; b < hSrc; ++b)
|
for (uint b = 0; b < hSrc; ++b)
|
||||||
for (a = 0; a < wSrc; ++a)
|
for (uint a = 0; a < wSrc; ++a)
|
||||||
{
|
{
|
||||||
if (rDstPix[4*((x+a)+(y+b)*pDst->getWidth())+3] != 0)
|
if (rDstPix[4*((x+a)+(y+b)*pDst->getWidth())+3] != 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// write
|
// write
|
||||||
putPixel(rDstPix + 4*((x+a)+(y+b)*pDst->getWidth()), rSrcPix+ 4*(a+b*pSrc->getWidth()), alphaTransfert);
|
putPixel(rDstPix + 4*((x+a)+(y+b)*pDst->getWidth()), rSrcPix+ 4*(a+b*pSrc->getWidth()), alphaTransfert);
|
||||||
}
|
}
|
||||||
|
@ -135,9 +134,9 @@ bool putIn (NLMISC::CBitmap *pSrc, NLMISC::CBitmap *pDst, sint32 x, sint32 y, bo
|
||||||
// expand on W
|
// expand on W
|
||||||
if(wSrc<wSrc4)
|
if(wSrc<wSrc4)
|
||||||
{
|
{
|
||||||
for(a=wSrc;a<wSrc4;a++)
|
for(uint a=wSrc;a<wSrc4;a++)
|
||||||
{
|
{
|
||||||
for(b=0;b<hSrc4;b++)
|
for(uint b=0;b<hSrc4;b++)
|
||||||
{
|
{
|
||||||
putPixel(rDstPix + 4*((x+a)+(y+b)*pDst->getWidth()), rDstPix + 4*((x+wSrc-1)+(y+b)*pDst->getWidth()), alphaTransfert);
|
putPixel(rDstPix + 4*((x+a)+(y+b)*pDst->getWidth()), rDstPix + 4*((x+wSrc-1)+(y+b)*pDst->getWidth()), alphaTransfert);
|
||||||
}
|
}
|
||||||
|
@ -146,9 +145,9 @@ bool putIn (NLMISC::CBitmap *pSrc, NLMISC::CBitmap *pDst, sint32 x, sint32 y, bo
|
||||||
// expand on H
|
// expand on H
|
||||||
if(hSrc<hSrc4)
|
if(hSrc<hSrc4)
|
||||||
{
|
{
|
||||||
for(b=hSrc;b<hSrc4;b++)
|
for(uint b=hSrc;b<hSrc4;b++)
|
||||||
{
|
{
|
||||||
for(a=0;a<wSrc4;a++)
|
for(uint a=0;a<wSrc4;a++)
|
||||||
{
|
{
|
||||||
putPixel(rDstPix + 4*((x+a)+(y+b)*pDst->getWidth()), rDstPix + 4*((x+a)+(y+hSrc-1)*pDst->getWidth()), alphaTransfert);
|
putPixel(rDstPix + 4*((x+a)+(y+b)*pDst->getWidth()), rDstPix + 4*((x+a)+(y+hSrc-1)*pDst->getWidth()), alphaTransfert);
|
||||||
}
|
}
|
||||||
|
@ -252,30 +251,38 @@ int main(int nNbArg, char **ppArgs)
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<NLMISC::CBitmap*> AllMaps;
|
vector<NLMISC::CBitmap*> AllMaps;
|
||||||
sint32 i, j;
|
sint32 j;
|
||||||
|
|
||||||
// Load all maps
|
// Load all maps
|
||||||
sint32 mapSize = (sint32)AllMapNames.size();
|
sint32 mapSize = (sint32)AllMapNames.size();
|
||||||
AllMaps.resize( mapSize );
|
AllMaps.resize( mapSize );
|
||||||
for( i = 0; i < mapSize; ++i )
|
for(sint i = 0; i < mapSize; ++i )
|
||||||
{
|
{
|
||||||
|
NLMISC::CBitmap *pBtmp = NULL;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
NLMISC::CBitmap *pBtmp = new NLMISC::CBitmap;
|
pBtmp = new NLMISC::CBitmap;
|
||||||
NLMISC::CIFile inFile;
|
NLMISC::CIFile inFile;
|
||||||
inFile.open( AllMapNames[i] );
|
if (!inFile.open( AllMapNames[i] )) throw NLMISC::Exception("Unable to open " + AllMapNames[i]);
|
||||||
pBtmp->load(inFile);
|
|
||||||
|
uint8 colors = pBtmp->load(inFile);
|
||||||
|
|
||||||
|
if (colors != 32) throw NLMISC::Exception(AllMapNames[i] + " is using " + toString(colors) + " bits colors, only 32 bit supported!");
|
||||||
|
|
||||||
AllMaps[i] = pBtmp;
|
AllMaps[i] = pBtmp;
|
||||||
}
|
}
|
||||||
catch (const NLMISC::Exception &e)
|
catch (const NLMISC::Exception &e)
|
||||||
{
|
{
|
||||||
|
if (pBtmp) delete pBtmp;
|
||||||
|
|
||||||
outString (string("ERROR :") + e.what());
|
outString (string("ERROR :") + e.what());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sort all maps by decreasing size
|
// Sort all maps by decreasing size
|
||||||
for (i = 0; i < mapSize-1; ++i)
|
for (sint i = 0; i < mapSize-1; ++i)
|
||||||
for (j = i+1; j < mapSize; ++j)
|
for (j = i+1; j < mapSize; ++j)
|
||||||
{
|
{
|
||||||
NLMISC::CBitmap *pBI = AllMaps[i];
|
NLMISC::CBitmap *pBI = AllMaps[i];
|
||||||
|
@ -303,7 +310,7 @@ int main(int nNbArg, char **ppArgs)
|
||||||
vector<NLMISC::CUV> UVMin, UVMax;
|
vector<NLMISC::CUV> UVMin, UVMax;
|
||||||
UVMin.resize (mapSize, NLMISC::CUV(0.0f, 0.0f));
|
UVMin.resize (mapSize, NLMISC::CUV(0.0f, 0.0f));
|
||||||
UVMax.resize (mapSize, NLMISC::CUV(0.0f, 0.0f));
|
UVMax.resize (mapSize, NLMISC::CUV(0.0f, 0.0f));
|
||||||
for (i = 0; i < mapSize; ++i)
|
for (sint i = 0; i < mapSize; ++i)
|
||||||
{
|
{
|
||||||
sint32 x, y;
|
sint32 x, y;
|
||||||
while (!tryAllPos(AllMaps[i], &GlobalMask, x, y))
|
while (!tryAllPos(AllMaps[i], &GlobalMask, x, y))
|
||||||
|
@ -349,7 +356,7 @@ int main(int nNbArg, char **ppArgs)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert UV from pixel to ratio
|
// Convert UV from pixel to ratio
|
||||||
for (i = 0; i < mapSize; ++i)
|
for (sint i = 0; i < mapSize; ++i)
|
||||||
{
|
{
|
||||||
UVMin[i].U = UVMin[i].U / (float)GlobalTexture.getWidth();
|
UVMin[i].U = UVMin[i].U / (float)GlobalTexture.getWidth();
|
||||||
UVMin[i].V = UVMin[i].V / (float)GlobalTexture.getHeight();
|
UVMin[i].V = UVMin[i].V / (float)GlobalTexture.getHeight();
|
||||||
|
@ -394,7 +401,7 @@ int main(int nNbArg, char **ppArgs)
|
||||||
FILE *f = fopen (fmtName.c_str(), "wt");
|
FILE *f = fopen (fmtName.c_str(), "wt");
|
||||||
if (f != NULL)
|
if (f != NULL)
|
||||||
{
|
{
|
||||||
for (i = 0; i < mapSize; ++i)
|
for (sint i = 0; i < mapSize; ++i)
|
||||||
{
|
{
|
||||||
// get the string whitout path
|
// get the string whitout path
|
||||||
string fileName= CFile::getFilename(AllMapNames[i]);
|
string fileName= CFile::getFilename(AllMapNames[i]);
|
||||||
|
@ -443,6 +450,8 @@ int main(int nNbArg, char **ppArgs)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sint i;
|
||||||
|
|
||||||
sTGAname = toLower(string(tgaName));
|
sTGAname = toLower(string(tgaName));
|
||||||
string findTGAName;
|
string findTGAName;
|
||||||
for (i = 0; i < mapSize; ++i)
|
for (i = 0; i < mapSize; ++i)
|
||||||
|
|
|
@ -167,6 +167,12 @@ void CIgLighterLib::lightIg(CInstanceLighter &instanceLighter,
|
||||||
string name= igIn.getShapeName(i);
|
string name= igIn.getShapeName(i);
|
||||||
bool shapeFound= true;
|
bool shapeFound= true;
|
||||||
|
|
||||||
|
if (toLower (CFile::getExtension (name)) == "pacs_prim")
|
||||||
|
{
|
||||||
|
nlwarning("EXPORT BUG: Can't read %s (not a shape), should not be part of .ig!", name.c_str());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Try to find the shape in the UseShapeMap.
|
// Try to find the shape in the UseShapeMap.
|
||||||
std::map<string, IShape*>::const_iterator iteMap= lightDesc.UserShapeMap.find (name);
|
std::map<string, IShape*>::const_iterator iteMap= lightDesc.UserShapeMap.find (name);
|
||||||
|
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
#ifndef OVQT_CONFIG_H
|
|
||||||
#define OVQT_CONFIG_H
|
|
||||||
|
|
||||||
#define DATA_DIR "${NL_SHARE_ABSOLUTE_PREFIX}/object_viewer_qt"
|
|
||||||
#define PLUGINS_DIR "${NL_LIB_ABSOLUTE_PREFIX}/object_viewer_qt"
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,53 +0,0 @@
|
||||||
ADD_SUBDIRECTORY(3rdparty)
|
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${LIBXML2_INCLUDE_DIR} ${NEL_INCLUDE_DIR} ${QT_INCLUDES})
|
|
||||||
INCLUDE( ${QT_USE_FILE} )
|
|
||||||
|
|
||||||
CONFIGURE_FILE(translations/translations.qrc ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc COPYONLY)
|
|
||||||
|
|
||||||
FILE(GLOB OBJECT_VIEWER_SRC extension_system/*.h
|
|
||||||
extension_system/*.cpp
|
|
||||||
*.h *.cpp)
|
|
||||||
|
|
||||||
SET(OBJECT_VIEWER_HDR extension_system/iplugin_manager.h
|
|
||||||
extension_system/plugin_manager.h)
|
|
||||||
|
|
||||||
SET(OBJECT_VIEWER_RCS object_viewer_qt.qrc ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc)
|
|
||||||
|
|
||||||
SET(OBJECT_VIEWER_TS translations/object_viewer_qt_en.ts
|
|
||||||
translations/object_viewer_qt_fr.ts
|
|
||||||
translations/object_viewer_qt_de.ts
|
|
||||||
translations/object_viewer_qt_ru.ts)
|
|
||||||
|
|
||||||
SET(QT_USE_QTGUI TRUE)
|
|
||||||
SET(QT_USE_QTOPENGL TRUE)
|
|
||||||
|
|
||||||
IF(WIN32)
|
|
||||||
SET(OBJECT_VIEWER_RC object_viewer_qt.rc)
|
|
||||||
ENDIF(WIN32)
|
|
||||||
|
|
||||||
QT4_ADD_TRANSLATION(OBJECT_VIEWER_QM ${OBJECT_VIEWER_TS})
|
|
||||||
QT4_ADD_RESOURCES( OBJECT_VIEWER_RC_SRCS ${OBJECT_VIEWER_RCS})
|
|
||||||
QT4_WRAP_CPP( OBJECT_VIEWER_MOC_SRCS ${OBJECT_VIEWER_HDR} )
|
|
||||||
|
|
||||||
SOURCE_GROUP(QtResources FILES ${OBJECT_VIEWER_RCS})
|
|
||||||
SOURCE_GROUP(QtGeneratedMocQrcSrc FILES ${OBJECT_VIEWER_MOC_SRCS} ${OBJECT_VIEWER_RC_SRCS})
|
|
||||||
|
|
||||||
ADD_EXECUTABLE(object_viewer_qt WIN32 MACOSX_BUNDLE
|
|
||||||
${OBJECT_VIEWER_SRC}
|
|
||||||
${OBJECT_VIEWER_MOC_SRCS}
|
|
||||||
${OBJECT_VIEWER_RC_SRCS}
|
|
||||||
${OBJECT_VIEWER_RC})
|
|
||||||
|
|
||||||
TARGET_LINK_LIBRARIES(object_viewer_qt
|
|
||||||
nelmisc
|
|
||||||
${QT_LIBRARIES}
|
|
||||||
${QT_QTMAIN_LIBRARY})
|
|
||||||
|
|
||||||
ADD_DEFINITIONS(-DQT_NO_KEYWORDS ${LIBXML2_DEFINITIONS} ${QT_DEFINITIONS})
|
|
||||||
NL_DEFAULT_PROPS(object_viewer_qt "NeL, Tools, 3D: Object Viewer Qt")
|
|
||||||
NL_ADD_RUNTIME_FLAGS(object_viewer_qt)
|
|
||||||
|
|
||||||
ADD_SUBDIRECTORY(plugins)
|
|
||||||
|
|
||||||
INSTALL(TARGETS object_viewer_qt RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT runtime BUNDLE DESTINATION /Applications)
|
|
Before Width: | Height: | Size: 135 KiB |
|
@ -1,163 +0,0 @@
|
||||||
// Object Viewer Qt - Georges Editor Plugin - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2011 Adrian Jaekel <aj at elane2k dot com>
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
#include "stdpch.h"
|
|
||||||
#include "formitem.h"
|
|
||||||
|
|
||||||
// Qt includes
|
|
||||||
|
|
||||||
// NeL includes
|
|
||||||
#include <nel/misc/o_xml.h>
|
|
||||||
#include <nel/georges/u_type.h>
|
|
||||||
#include <nel/georges/form.h>
|
|
||||||
|
|
||||||
namespace GeorgesQt
|
|
||||||
{
|
|
||||||
|
|
||||||
CFormItem::CFormItem(NLGEORGES::UFormElm* elm, const QList<QVariant> &data, CFormItem *parent,
|
|
||||||
NLGEORGES::UFormElm::TWhereIsValue wV, NLGEORGES::UFormElm::TWhereIsNode wN)
|
|
||||||
{
|
|
||||||
parentItem = parent;
|
|
||||||
itemData = data;
|
|
||||||
formElm = elm;
|
|
||||||
whereV = wV;
|
|
||||||
whereN = wN;
|
|
||||||
}
|
|
||||||
|
|
||||||
CFormItem::~CFormItem()
|
|
||||||
{
|
|
||||||
qDeleteAll(childItems);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CFormItem::appendChild(CFormItem *item)
|
|
||||||
{
|
|
||||||
childItems.append(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
CFormItem *CFormItem::child(int row)
|
|
||||||
{
|
|
||||||
return childItems.value(row);
|
|
||||||
}
|
|
||||||
|
|
||||||
int CFormItem::childCount() const
|
|
||||||
{
|
|
||||||
return childItems.count();
|
|
||||||
}
|
|
||||||
|
|
||||||
int CFormItem::columnCount() const
|
|
||||||
{
|
|
||||||
//nlinfo("columnCount %d",itemData.count());
|
|
||||||
return itemData.count();
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariant CFormItem::data(int column) const
|
|
||||||
{
|
|
||||||
return itemData.value(column);
|
|
||||||
}
|
|
||||||
|
|
||||||
CFormItem *CFormItem::parent()
|
|
||||||
{
|
|
||||||
return parentItem;
|
|
||||||
}
|
|
||||||
|
|
||||||
int CFormItem::row() const
|
|
||||||
{
|
|
||||||
if (parentItem)
|
|
||||||
return parentItem->childItems.indexOf(const_cast<CFormItem*>(this));
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CFormItem::setData(int column, const QVariant &value)
|
|
||||||
{
|
|
||||||
if (column < 0 || column >= itemData.size())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// TODO: default values
|
|
||||||
if (!formElm)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
itemData[column] = value;
|
|
||||||
if (formElm->isAtom())
|
|
||||||
{
|
|
||||||
const NLGEORGES::UType *type = formElm->getType();
|
|
||||||
if (type)
|
|
||||||
{
|
|
||||||
switch (type->getType())
|
|
||||||
{
|
|
||||||
case NLGEORGES::UType::UnsignedInt:
|
|
||||||
case NLGEORGES::UType::SignedInt:
|
|
||||||
case NLGEORGES::UType::Double:
|
|
||||||
case NLGEORGES::UType::String:
|
|
||||||
if (parentItem->formElm->isArray())
|
|
||||||
{
|
|
||||||
//((NLGEORGES::CFormElm*)parentItem->formElm);//->arrayInsertNodeByName(
|
|
||||||
//if(parentItem->formElm->getArrayNode(elmName, num))
|
|
||||||
//{
|
|
||||||
//}
|
|
||||||
|
|
||||||
bool ok;
|
|
||||||
// TODO: the node can be renamed from eg "#0" to "foobar"
|
|
||||||
int arrayIndex = itemData[0].toString().remove("#").toInt(&ok);
|
|
||||||
if(ok)
|
|
||||||
{
|
|
||||||
NLGEORGES::UFormElm *elmt = 0;
|
|
||||||
if(parentItem->formElm->getArrayNode(&elmt, arrayIndex) && elmt)
|
|
||||||
{
|
|
||||||
if (elmt->isAtom())
|
|
||||||
{
|
|
||||||
((NLGEORGES::CFormElmAtom*)elmt)->setValue(value.toString().toUtf8().constData());
|
|
||||||
nldebug(QString("array element string %1 %2")
|
|
||||||
.arg(itemData[0].toString()).arg(value.toString())
|
|
||||||
.toUtf8().constData());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(parentItem->formElm->setValueByName(
|
|
||||||
value.toString().toUtf8().constData(),
|
|
||||||
itemData[0].toString().toUtf8().constData()))
|
|
||||||
{
|
|
||||||
nldebug(QString("string %1 %2")
|
|
||||||
.arg(itemData[0].toString()).arg(value.toString())
|
|
||||||
.toUtf8().constData());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
nldebug(QString("FAILED string %1 %2")
|
|
||||||
.arg(itemData[0].toString()).arg(value.toString())
|
|
||||||
.toUtf8().constData());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case NLGEORGES::UType::Color:
|
|
||||||
nldebug("Color is TODO");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
nldebug("setting sth other than Atom");
|
|
||||||
}
|
|
||||||
//formElm->setValueByName();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,5 +0,0 @@
|
||||||
<RCC>
|
|
||||||
<qresource>
|
|
||||||
<file>images/ic_nel_georges_editor.png</file>
|
|
||||||
</qresource>
|
|
||||||
</RCC>
|
|
|
@ -1,704 +0,0 @@
|
||||||
// Object Viewer Qt - Georges Editor Plugin - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2011 Adrian Jaekel <aj at elane2k dot com>
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
#include "stdpch.h"
|
|
||||||
#include "georgesform_model.h"
|
|
||||||
#include "formitem.h"
|
|
||||||
|
|
||||||
// NeL includes
|
|
||||||
#include <nel/misc/types_nl.h>
|
|
||||||
#include <nel/misc/rgba.h>
|
|
||||||
#include <nel/misc/path.h>
|
|
||||||
#include <nel/georges/u_form_elm.h>
|
|
||||||
#include <nel/georges/u_type.h>
|
|
||||||
#include <nel/georges/u_form_dfn.h>
|
|
||||||
|
|
||||||
// Qt includes
|
|
||||||
#include <QColor>
|
|
||||||
#include <QBrush>
|
|
||||||
#include <QApplication>
|
|
||||||
#include <QStyle>
|
|
||||||
#include <QDebug>
|
|
||||||
#include <QStylePainter>
|
|
||||||
#include <QStyleOption>
|
|
||||||
#include <QLabel>
|
|
||||||
#include <QPixmap>
|
|
||||||
|
|
||||||
using namespace NLGEORGES;
|
|
||||||
|
|
||||||
namespace GeorgesQt
|
|
||||||
{
|
|
||||||
|
|
||||||
CGeorgesFormModel::CGeorgesFormModel(UFormElm *rootElm, QMap< QString, QStringList> deps,
|
|
||||||
QString comment, QStringList parents, bool *expanded, QObject *parent) : QAbstractItemModel(parent)
|
|
||||||
{
|
|
||||||
|
|
||||||
m_rootData << "Value" << "Data" << "Extra";// << "Type";
|
|
||||||
m_rootElm = rootElm;
|
|
||||||
m_rootItem = new CFormItem(m_rootElm, m_rootData);
|
|
||||||
m_dependencies = deps;
|
|
||||||
m_comments = comment;
|
|
||||||
m_parents = parents;
|
|
||||||
m_parentRows = new QList<const QModelIndex*>;
|
|
||||||
m_expanded = expanded;
|
|
||||||
|
|
||||||
setupModelData();
|
|
||||||
}
|
|
||||||
|
|
||||||
CGeorgesFormModel::~CGeorgesFormModel()
|
|
||||||
{
|
|
||||||
delete m_rootItem;
|
|
||||||
}
|
|
||||||
|
|
||||||
/******************************************************************************/
|
|
||||||
|
|
||||||
QVariant CGeorgesFormModel::data(const QModelIndex &p_index, int p_role) const
|
|
||||||
{
|
|
||||||
if (!p_index.isValid())
|
|
||||||
return QVariant();
|
|
||||||
|
|
||||||
switch (p_role)
|
|
||||||
{
|
|
||||||
case Qt::DisplayRole:
|
|
||||||
{
|
|
||||||
return getItem(p_index)->data(p_index.column());
|
|
||||||
}
|
|
||||||
case Qt::BackgroundRole:
|
|
||||||
{
|
|
||||||
QBrush defaultBrush = QBrush(QColor(255,0,0,30));
|
|
||||||
QBrush parentBrush = QBrush(QColor(0,255,0,30));
|
|
||||||
|
|
||||||
// if elm not existing it must be some kind of default or type value
|
|
||||||
if(!getItem(p_index)->getFormElm())
|
|
||||||
{
|
|
||||||
return defaultBrush;
|
|
||||||
}
|
|
||||||
|
|
||||||
// else it might be some parent elm
|
|
||||||
switch (getItem(p_index)->nodeFrom())
|
|
||||||
{
|
|
||||||
case NLGEORGES::UFormElm::NodeParentForm:
|
|
||||||
{
|
|
||||||
return parentBrush;
|
|
||||||
}
|
|
||||||
case NLGEORGES::UFormElm::NodeForm:
|
|
||||||
{
|
|
||||||
switch (getItem(p_index)->valueFrom())
|
|
||||||
{
|
|
||||||
case NLGEORGES::UFormElm::ValueParentForm:
|
|
||||||
{
|
|
||||||
return parentBrush;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
// parent status test kindof ugly, testing only 2 steps deep
|
|
||||||
// only needed for colorization as treeview default hides childs
|
|
||||||
// when parent is hidden
|
|
||||||
CFormItem *parent = getItem(p_index)->parent();
|
|
||||||
if (parent)
|
|
||||||
{
|
|
||||||
if (parent->nodeFrom() == NLGEORGES::UFormElm::NodeParentForm)
|
|
||||||
{
|
|
||||||
return parentBrush;
|
|
||||||
}
|
|
||||||
|
|
||||||
CFormItem *parentParent = parent->parent();
|
|
||||||
if (parentParent)
|
|
||||||
{
|
|
||||||
if (parentParent->nodeFrom() == NLGEORGES::UFormElm::NodeParentForm)
|
|
||||||
{
|
|
||||||
return parentBrush;
|
|
||||||
}
|
|
||||||
} // endif parentParent
|
|
||||||
} // endif parent
|
|
||||||
} // end default
|
|
||||||
} // end switch valueFrom
|
|
||||||
} // end case nodeForm
|
|
||||||
} // end switch nodeFrom
|
|
||||||
return QVariant();
|
|
||||||
}
|
|
||||||
case Qt::DecorationRole:
|
|
||||||
{
|
|
||||||
if (p_index.column() == 2)
|
|
||||||
{
|
|
||||||
//p_index.
|
|
||||||
QModelIndex in = index(p_index.row(),p_index.column()-1,p_index.parent());
|
|
||||||
CFormItem *item = getItem(in);
|
|
||||||
|
|
||||||
QString value = item->data(1).toString();
|
|
||||||
//QString path = NLMISC::CPath::lookup(value.toUtf8().constData(),false).c_str();
|
|
||||||
|
|
||||||
/*if (value.contains(".shape"))
|
|
||||||
{
|
|
||||||
if (Modules::objViewInt())
|
|
||||||
{
|
|
||||||
QIcon *icon = Modules::objViewInt()->saveOneImage(value.toUtf8().constData());
|
|
||||||
if (icon)
|
|
||||||
{
|
|
||||||
if(icon->isNull())
|
|
||||||
return QIcon(":/images/pqrticles.png");
|
|
||||||
else
|
|
||||||
return QIcon(*icon);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return QIcon();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
if(value.contains(".tga") || value.contains(".png"))
|
|
||||||
{
|
|
||||||
QString path = NLMISC::CPath::lookup(value.toUtf8().constData(),false).c_str();
|
|
||||||
if(path.isEmpty())
|
|
||||||
{
|
|
||||||
path = ":/images/pqrticles.png";
|
|
||||||
}
|
|
||||||
return QIcon(path);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return QVariant();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case Qt::ToolTipRole:
|
|
||||||
{
|
|
||||||
if (p_index.column() == 2)
|
|
||||||
{
|
|
||||||
QModelIndex in = index(p_index.row(),p_index.column()-1,p_index.parent());
|
|
||||||
CFormItem *item = getItem(in);
|
|
||||||
QString value = item->data(1).toString();
|
|
||||||
|
|
||||||
/*if (value.contains(".shape"))
|
|
||||||
{
|
|
||||||
if (Modules::objViewInt())
|
|
||||||
{
|
|
||||||
QIcon *icon = Modules::objViewInt()->saveOneImage(value.toUtf8().constData());
|
|
||||||
if (icon)
|
|
||||||
{
|
|
||||||
if(icon->isNull())
|
|
||||||
return QIcon(":/images/pqrticles.png");
|
|
||||||
else
|
|
||||||
return QIcon(*icon);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return QIcon();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
if(value.contains(".tga") || value.contains(".png"))
|
|
||||||
{
|
|
||||||
QString path = NLMISC::CPath::lookup(value.toUtf8().constData(),false).c_str();
|
|
||||||
if(path.isEmpty())
|
|
||||||
{
|
|
||||||
path = ":/images/pqrticles.png";
|
|
||||||
}
|
|
||||||
|
|
||||||
QString imageTooltip = QString("<img src='%1'>").arg(path);
|
|
||||||
|
|
||||||
return imageTooltip;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return QVariant();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
return QVariant();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/******************************************************************************/
|
|
||||||
|
|
||||||
CFormItem *CGeorgesFormModel::getItem(const QModelIndex &index) const
|
|
||||||
{
|
|
||||||
if (index.isValid())
|
|
||||||
{
|
|
||||||
CFormItem *item = static_cast<CFormItem*>(index.internalPointer());
|
|
||||||
if (item)
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
return m_rootItem;
|
|
||||||
}
|
|
||||||
|
|
||||||
/******************************************************************************/
|
|
||||||
|
|
||||||
bool CGeorgesFormModel::setData(const QModelIndex &index, const QVariant &value,
|
|
||||||
int role)
|
|
||||||
{
|
|
||||||
|
|
||||||
if (role != Qt::EditRole)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
CFormItem *item = getItem(index);
|
|
||||||
bool result = item->setData(index.column(), value);
|
|
||||||
|
|
||||||
Q_EMIT dataChanged(index, index);
|
|
||||||
|
|
||||||
//setupModelData();
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/******************************************************************************/
|
|
||||||
|
|
||||||
Qt::ItemFlags CGeorgesFormModel::flags(const QModelIndex& index) const {
|
|
||||||
|
|
||||||
if (!index.isValid())
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
Qt::ItemFlags returnValue = Qt::ItemIsSelectable | Qt::ItemIsEnabled;
|
|
||||||
|
|
||||||
if(index.column() == 1)
|
|
||||||
returnValue |= Qt::ItemIsEditable;
|
|
||||||
|
|
||||||
return returnValue;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/******************************************************************************/
|
|
||||||
|
|
||||||
QVariant CGeorgesFormModel::headerData(int section,
|
|
||||||
Qt::Orientation orientation, int role) const
|
|
||||||
{
|
|
||||||
if (orientation == Qt::Horizontal)
|
|
||||||
{
|
|
||||||
if (role == Qt::DisplayRole)
|
|
||||||
return m_rootItem->data(section);
|
|
||||||
if (role == Qt::TextAlignmentRole)
|
|
||||||
return Qt::AlignLeft;
|
|
||||||
if (section == 0 && role == Qt::DecorationRole)
|
|
||||||
{
|
|
||||||
// transparent pixmap as we paint it ourself with tree brach
|
|
||||||
// if we extend the HeaderView::paintSection for the CE_HeaderLabel
|
|
||||||
// we could drop this
|
|
||||||
QPixmap pixmap = QPixmap(
|
|
||||||
QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize),
|
|
||||||
QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize));
|
|
||||||
// Create new picture for transparent
|
|
||||||
QPixmap transparent(pixmap.size());
|
|
||||||
|
|
||||||
// Do transparency
|
|
||||||
transparent.fill(Qt::transparent);
|
|
||||||
QPainter p(&transparent);
|
|
||||||
p.setCompositionMode(QPainter::CompositionMode_Source);
|
|
||||||
p.drawPixmap(0, 0, pixmap);
|
|
||||||
p.setCompositionMode(QPainter::CompositionMode_DestinationIn);
|
|
||||||
// Set transparency level to 150 (possible values are 0-255)
|
|
||||||
// The alpha channel of a color specifies the transparency effect,
|
|
||||||
// 0 represents a fully transparent color, while 255 represents
|
|
||||||
// a fully opaque color.
|
|
||||||
p.fillRect(transparent.rect(), QColor(0, 0, 0, 0));
|
|
||||||
p.end();
|
|
||||||
|
|
||||||
// Set original picture's reference to new transparent one
|
|
||||||
pixmap = transparent;
|
|
||||||
return pixmap;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return QVariant();
|
|
||||||
}
|
|
||||||
|
|
||||||
/******************************************************************************/
|
|
||||||
|
|
||||||
QModelIndex CGeorgesFormModel::index(int row, int column, const QModelIndex &parent)
|
|
||||||
const
|
|
||||||
{
|
|
||||||
if (!hasIndex(row, column, parent))
|
|
||||||
return QModelIndex();
|
|
||||||
|
|
||||||
CFormItem *parentItem;
|
|
||||||
|
|
||||||
if (!parent.isValid())
|
|
||||||
parentItem = m_rootItem;
|
|
||||||
else
|
|
||||||
parentItem = static_cast<CFormItem*>(parent.internalPointer());
|
|
||||||
|
|
||||||
CFormItem *childItem = parentItem->child(row);
|
|
||||||
if (childItem)
|
|
||||||
return createIndex(row, column, childItem);
|
|
||||||
else
|
|
||||||
return QModelIndex();
|
|
||||||
}
|
|
||||||
|
|
||||||
/******************************************************************************/
|
|
||||||
|
|
||||||
QModelIndex CGeorgesFormModel::parent(const QModelIndex &index) const
|
|
||||||
{
|
|
||||||
if (!index.isValid())
|
|
||||||
return QModelIndex();
|
|
||||||
|
|
||||||
CFormItem *childItem = static_cast<CFormItem*>(index.internalPointer());
|
|
||||||
CFormItem *parentItem = childItem->parent();
|
|
||||||
|
|
||||||
if (parentItem == m_rootItem)
|
|
||||||
return QModelIndex();
|
|
||||||
|
|
||||||
return createIndex(parentItem->row(), 0, parentItem);
|
|
||||||
}
|
|
||||||
|
|
||||||
/******************************************************************************/
|
|
||||||
|
|
||||||
int CGeorgesFormModel::rowCount(const QModelIndex &parent) const {
|
|
||||||
|
|
||||||
CFormItem *parentItem;
|
|
||||||
if (parent.column() > 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (!parent.isValid())
|
|
||||||
parentItem = m_rootItem;
|
|
||||||
else
|
|
||||||
parentItem = static_cast<CFormItem*>(parent.internalPointer());
|
|
||||||
|
|
||||||
return parentItem->childCount();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/******************************************************************************/
|
|
||||||
|
|
||||||
int CGeorgesFormModel::columnCount(const QModelIndex &parent) const {
|
|
||||||
|
|
||||||
if (parent.isValid())
|
|
||||||
return static_cast<CFormItem*>(parent.internalPointer())->columnCount();
|
|
||||||
else
|
|
||||||
return m_rootItem->columnCount();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/******************************************************************************/
|
|
||||||
|
|
||||||
void CGeorgesFormModel::loadFormData(UFormElm *root, CFormItem *parent) {
|
|
||||||
|
|
||||||
if (!root)
|
|
||||||
return;
|
|
||||||
|
|
||||||
uint num = 0;
|
|
||||||
|
|
||||||
|
|
||||||
if (root->isStruct())
|
|
||||||
{
|
|
||||||
//((CFormElm*)root)->getForm()->getComment();
|
|
||||||
uint structSize = 0;
|
|
||||||
root->getStructSize(structSize);
|
|
||||||
while (num < structSize)
|
|
||||||
{
|
|
||||||
UFormElm::TWhereIsNode *whereN = new UFormElm::TWhereIsNode;
|
|
||||||
UFormElm::TWhereIsValue *whereV = new UFormElm::TWhereIsValue;
|
|
||||||
// Append a new item to the current parent's list of children.
|
|
||||||
std::string elmName;
|
|
||||||
if(root->getStructNodeName(num, elmName))
|
|
||||||
{
|
|
||||||
QList<QVariant> columnData;
|
|
||||||
//QVariant value;
|
|
||||||
std::string value;
|
|
||||||
//NLMISC::CRGBA value_color;
|
|
||||||
//uint value_uint;
|
|
||||||
//sint value_sint;
|
|
||||||
//double value_double;
|
|
||||||
QString elmtType;
|
|
||||||
UFormElm *elmt = 0;
|
|
||||||
if(root->getNodeByName(&elmt, elmName.c_str(), whereN, true))
|
|
||||||
{
|
|
||||||
if (elmt)
|
|
||||||
{
|
|
||||||
if (elmt->isArray())
|
|
||||||
elmtType = "Array";
|
|
||||||
if (elmt->isStruct())
|
|
||||||
elmtType = "Struct";
|
|
||||||
if (elmt->isAtom())
|
|
||||||
{
|
|
||||||
elmtType = "Atom";
|
|
||||||
uint numDefinitions = 0;
|
|
||||||
const UType *type = elmt->getType();
|
|
||||||
if (type)
|
|
||||||
{
|
|
||||||
numDefinitions = type->getNumDefinition();
|
|
||||||
root->getValueByName(value, elmName.c_str(),UFormElm::Eval,whereV);
|
|
||||||
switch (type->getType())
|
|
||||||
{
|
|
||||||
case UType::UnsignedInt:
|
|
||||||
{
|
|
||||||
uint v;
|
|
||||||
NLMISC::fromString(value, v);
|
|
||||||
value = NLMISC::toString(v);
|
|
||||||
elmtType.append("_uint");break;
|
|
||||||
}
|
|
||||||
case UType::SignedInt:
|
|
||||||
{
|
|
||||||
sint v;
|
|
||||||
NLMISC::fromString(value, v);
|
|
||||||
value = NLMISC::toString(v);
|
|
||||||
elmtType.append("_sint");break;
|
|
||||||
}
|
|
||||||
case UType::Double:
|
|
||||||
float v;
|
|
||||||
NLMISC::fromString(value, v);
|
|
||||||
value = NLMISC::toString(v);
|
|
||||||
elmtType.append("_double");break;
|
|
||||||
case UType::String:
|
|
||||||
elmtType.append("_string");break;
|
|
||||||
case UType::Color:
|
|
||||||
elmtType.append("_color");break;
|
|
||||||
default:
|
|
||||||
elmtType.append("_unknownType");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
elmtType.append("_noType");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (numDefinitions)
|
|
||||||
{
|
|
||||||
std::string l, v;
|
|
||||||
QString tmpLabel, tmpValue;
|
|
||||||
for (uint i = 0; i < numDefinitions; i++)
|
|
||||||
{
|
|
||||||
type->getDefinition(i,l,v);
|
|
||||||
tmpLabel = l.c_str();
|
|
||||||
tmpValue = v.c_str();
|
|
||||||
if (type->getType() == UType::SignedInt)
|
|
||||||
{
|
|
||||||
if (QString("%1").arg(value.c_str()).toDouble() == tmpValue.toDouble()) {
|
|
||||||
value = l;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (type->getType() == UType::String)
|
|
||||||
{
|
|
||||||
if (QString(value.c_str()) == tmpValue)
|
|
||||||
{
|
|
||||||
value = l;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (elmt->isVirtualStruct())
|
|
||||||
{
|
|
||||||
root->getValueByName(value, elmName.c_str(),UFormElm::Eval,whereV);
|
|
||||||
elmtType = "VirtualStruct";
|
|
||||||
}
|
|
||||||
switch (*whereN)
|
|
||||||
{
|
|
||||||
case UFormElm::NodeForm:
|
|
||||||
elmtType.append("_fromForm"); break;
|
|
||||||
case UFormElm::NodeParentForm:
|
|
||||||
elmtType.append("_fromParentForm"); break;
|
|
||||||
case UFormElm::NodeDfn:
|
|
||||||
elmtType.append("_isDFN"); break;
|
|
||||||
case UFormElm::NodeType:
|
|
||||||
elmtType.append("_isType"); break;
|
|
||||||
default:
|
|
||||||
elmtType.append("_noNode");
|
|
||||||
}
|
|
||||||
switch (*whereV)
|
|
||||||
{
|
|
||||||
case UFormElm::ValueForm:
|
|
||||||
elmtType.append("_formValue"); break;
|
|
||||||
case UFormElm::ValueParentForm:
|
|
||||||
elmtType.append("_parentValue"); break;
|
|
||||||
case UFormElm::ValueDefaultDfn:
|
|
||||||
elmtType.append("_dfnValue"); break;
|
|
||||||
case UFormElm::ValueDefaultType:
|
|
||||||
elmtType.append("_typeValue"); break;
|
|
||||||
default:
|
|
||||||
elmtType.append("_noValue");
|
|
||||||
}
|
|
||||||
columnData << QString(elmName.c_str()) << QString(value.c_str()) << "";// << elmtType;
|
|
||||||
parent->appendChild(new CFormItem(elmt, columnData, parent, *whereV, *whereN));
|
|
||||||
//if (parents.last()->childCount() > 0) {
|
|
||||||
// parents << parents.last()->child(parents.last()->childCount()-1);
|
|
||||||
//}
|
|
||||||
loadFormData(elmt, parent->child(parent->childCount()-1));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// add Defaults
|
|
||||||
// TODO: spams warnings for non ATOM values but i dont get type of non existing nodes
|
|
||||||
bool success = root->getValueByName(value, elmName.c_str(),UFormElm::Eval,whereV);
|
|
||||||
switch (*whereN)
|
|
||||||
{
|
|
||||||
case UFormElm::NodeForm:
|
|
||||||
elmtType.append("_fromForm"); break;
|
|
||||||
case UFormElm::NodeParentForm:
|
|
||||||
elmtType.append("_fromParentForm"); break;
|
|
||||||
case UFormElm::NodeDfn:
|
|
||||||
elmtType.append("_isDFN"); break;
|
|
||||||
case UFormElm::NodeType:
|
|
||||||
elmtType.append("_isType"); break;
|
|
||||||
default:
|
|
||||||
elmtType.append("_noNode");
|
|
||||||
}
|
|
||||||
switch (*whereV)
|
|
||||||
{
|
|
||||||
case UFormElm::ValueForm:
|
|
||||||
elmtType.append("_formValue"); break;
|
|
||||||
case UFormElm::ValueParentForm:
|
|
||||||
elmtType.append("_parentValue"); break;
|
|
||||||
case UFormElm::ValueDefaultDfn:
|
|
||||||
elmtType.append("_dfnValue"); break;
|
|
||||||
case UFormElm::ValueDefaultType:
|
|
||||||
elmtType.append("_typeValue"); break;
|
|
||||||
default:
|
|
||||||
elmtType.append("_noValue");
|
|
||||||
}
|
|
||||||
|
|
||||||
columnData << QString(elmName.c_str()) << QString(value.c_str()) << "";// << elmtType;
|
|
||||||
parent->appendChild(new CFormItem(elmt, columnData, parent, *whereV, *whereN));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
nlinfo("getNodeByName returned false");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
num++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (root->isArray())
|
|
||||||
{
|
|
||||||
uint arraySize = 0;
|
|
||||||
root->getArraySize(arraySize);
|
|
||||||
while (num < arraySize)
|
|
||||||
{
|
|
||||||
std::string elmName;
|
|
||||||
if(root->getArrayNodeName(elmName, num))
|
|
||||||
{
|
|
||||||
QList<QVariant> columnData;
|
|
||||||
std::string value;
|
|
||||||
QString elmtType;
|
|
||||||
|
|
||||||
UFormElm *elmt = 0;
|
|
||||||
if(root->getArrayNode(&elmt,0) && elmt)
|
|
||||||
{
|
|
||||||
if (elmt->isArray())
|
|
||||||
elmtType = "Array";
|
|
||||||
if (elmt->isStruct()) {
|
|
||||||
elmtType = "Struct";
|
|
||||||
}
|
|
||||||
if (elmt->isAtom())
|
|
||||||
{
|
|
||||||
elmt->getValue(value);
|
|
||||||
elmtType = "Atom";
|
|
||||||
}
|
|
||||||
if (elmt->isVirtualStruct())
|
|
||||||
elmtType = "VirtualStruct";
|
|
||||||
|
|
||||||
elmtType.append("_arrayValue");
|
|
||||||
columnData << QString(elmName.c_str()) << QString(value.c_str()) << "";// << elmtType;
|
|
||||||
parent->appendChild(new CFormItem(elmt, columnData, parent));
|
|
||||||
loadFormData(elmt, parent->child(parent->childCount()-1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
num++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/******************************************************************************/
|
|
||||||
|
|
||||||
void CGeorgesFormModel::loadFormHeader()
|
|
||||||
{
|
|
||||||
|
|
||||||
if (m_parents.size())
|
|
||||||
{
|
|
||||||
CFormItem *fi_pars = new CFormItem(m_rootElm, QList<QVariant>() << "parents" << "" << "", m_rootItem);
|
|
||||||
m_rootItem->appendChild(fi_pars);
|
|
||||||
|
|
||||||
Q_FOREACH(QString str, m_parents)
|
|
||||||
{
|
|
||||||
fi_pars->appendChild(new CFormItem(m_rootElm, QList<QVariant>() << str << "" << "", fi_pars));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*QStringList dfns = _dependencies["dfn"];
|
|
||||||
QStringList typs = _dependencies["typ"];
|
|
||||||
|
|
||||||
_dependencies.remove("dfn");
|
|
||||||
_dependencies.remove("typ");
|
|
||||||
|
|
||||||
CFormItem *fi_dep = new CFormItem(_rootElm, QList<QVariant>() << "dependencies", _rootItem);
|
|
||||||
_rootItem->appendChild(fi_dep);
|
|
||||||
|
|
||||||
if (!dfns.isEmpty()) {
|
|
||||||
CFormItem *fi_dfn = new CFormItem(_rootElm, QList<QVariant>() << "dfn", fi_dep);
|
|
||||||
fi_dep->appendChild(fi_dfn);
|
|
||||||
foreach(QString str, dfns) {
|
|
||||||
fi_dfn->appendChild(new CFormItem(_rootElm, QList<QVariant>() << str, fi_dfn));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!typs.isEmpty()) {
|
|
||||||
CFormItem *fi_typ = new CFormItem(_rootElm, QList<QVariant>() << "typ", fi_dep);
|
|
||||||
fi_dep->appendChild(fi_typ);
|
|
||||||
foreach(QString str, typs) {
|
|
||||||
fi_typ->appendChild(new CFormItem(_rootElm, QList<QVariant>() << str, fi_typ));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!_dependencies.isEmpty()) {
|
|
||||||
CFormItem *fi_other = new CFormItem(_rootElm, QList<QVariant>() << "other", fi_dep);
|
|
||||||
fi_dep->appendChild(fi_other);
|
|
||||||
foreach(QStringList list, _dependencies) {
|
|
||||||
foreach(QString str, list) {
|
|
||||||
fi_other->appendChild(new CFormItem(_rootElm, QList<QVariant>() << str, fi_other));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
|
|
||||||
/******************************************************************************/
|
|
||||||
|
|
||||||
void CGeorgesFormModel::setupModelData()
|
|
||||||
{
|
|
||||||
loadFormHeader();
|
|
||||||
loadFormData(m_rootElm, m_rootItem);
|
|
||||||
}
|
|
||||||
|
|
||||||
/******************************************************************************/
|
|
||||||
|
|
||||||
void CGeorgesFormModel::setShowParents( bool show ) {
|
|
||||||
m_showParents = show;
|
|
||||||
Q_EMIT layoutAboutToBeChanged();
|
|
||||||
Q_EMIT layoutChanged();
|
|
||||||
}
|
|
||||||
void CGeorgesFormModel::setShowDefaults( bool show )
|
|
||||||
{
|
|
||||||
m_showDefaults = show;
|
|
||||||
Q_EMIT layoutAboutToBeChanged();
|
|
||||||
Q_EMIT layoutChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CGeorgesFormModel::addParentForm(QString parentForm)
|
|
||||||
{
|
|
||||||
beginResetModel();
|
|
||||||
m_parents.push_back(parentForm);
|
|
||||||
delete m_rootItem;
|
|
||||||
m_rootItem = new CFormItem(m_rootElm, m_rootData);
|
|
||||||
setupModelData();
|
|
||||||
endResetModel();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CGeorgesFormModel::removeParentForm(QString parentForm)
|
|
||||||
{
|
|
||||||
beginResetModel();
|
|
||||||
m_parents.removeOne(parentForm);
|
|
||||||
|
|
||||||
delete m_rootItem;
|
|
||||||
m_rootItem = new CFormItem(m_rootElm, m_rootData);
|
|
||||||
setupModelData();
|
|
||||||
endResetModel();
|
|
||||||
}
|
|
||||||
} /* namespace GeorgesQt */
|
|
||||||
|
|
||||||
/* end of file */
|
|
|
@ -1,174 +0,0 @@
|
||||||
// Object Viewer Qt GUI Editor plugin <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
#include "nel3d_widget.h"
|
|
||||||
#include "nel/3d/u_driver.h"
|
|
||||||
#include "nel/3d/text_context.h"
|
|
||||||
#include "nel/3d/driver_user.h"
|
|
||||||
#include "nel/misc/rgba.h"
|
|
||||||
#include "nel/misc/path.h"
|
|
||||||
#include "nel/misc/event_listener.h"
|
|
||||||
#include "nel/gui/event_listener.h"
|
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
|
||||||
#include <Windows.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace GUIEditor
|
|
||||||
{
|
|
||||||
Nel3DWidget::Nel3DWidget( QWidget *parent ) :
|
|
||||||
QWidget( parent )
|
|
||||||
{
|
|
||||||
driver = NULL;
|
|
||||||
textContext = NULL;
|
|
||||||
|
|
||||||
// Need to set this attribute with a NULL paintengine returned to Qt
|
|
||||||
// so that we can render the widget normally ourselves, without the image
|
|
||||||
// disappearing when a widget is resized or shown on top of us
|
|
||||||
setAttribute( Qt::WA_PaintOnScreen, true );
|
|
||||||
eventListener = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
Nel3DWidget::~Nel3DWidget()
|
|
||||||
{
|
|
||||||
if( driver != NULL )
|
|
||||||
{
|
|
||||||
if( textContext != NULL )
|
|
||||||
{
|
|
||||||
driver->deleteTextContext( textContext );
|
|
||||||
textContext = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
driver->release();
|
|
||||||
delete driver;
|
|
||||||
driver = NULL;
|
|
||||||
}
|
|
||||||
delete eventListener;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Nel3DWidget::init()
|
|
||||||
{
|
|
||||||
nlassert( driver == NULL );
|
|
||||||
|
|
||||||
driver = NL3D::UDriver::createDriver( 0, false, 0 );
|
|
||||||
driver->setMatrixMode2D11();
|
|
||||||
driver->setDisplay( winId(), NL3D::UDriver::CMode( width(), height(), 32, true ) );
|
|
||||||
eventListener = new NLGUI::CEventListener();
|
|
||||||
eventListener->addToServer( &driver->EventServer );
|
|
||||||
}
|
|
||||||
|
|
||||||
void Nel3DWidget::createTextContext( std::string fontFile )
|
|
||||||
{
|
|
||||||
if( driver == NULL )
|
|
||||||
return;
|
|
||||||
|
|
||||||
std::string font;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
font = NLMISC::CPath::lookup( fontFile );
|
|
||||||
}
|
|
||||||
catch( ... )
|
|
||||||
{
|
|
||||||
nlinfo( "Font %s cannot be found, cannot create textcontext!", fontFile.c_str() );
|
|
||||||
exit( EXIT_FAILURE );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( textContext != NULL )
|
|
||||||
{
|
|
||||||
driver->deleteTextContext( textContext );
|
|
||||||
textContext = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
textContext = driver->createTextContext( font );
|
|
||||||
}
|
|
||||||
|
|
||||||
void Nel3DWidget::clear()
|
|
||||||
{
|
|
||||||
if( driver == NULL )
|
|
||||||
return;
|
|
||||||
driver->clearBuffers( NLMISC::CRGBA::Black );
|
|
||||||
driver->swapBuffers();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#if defined ( NL_OS_WINDOWS )
|
|
||||||
|
|
||||||
typedef bool ( *winProc )( NL3D::IDriver *driver, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam );
|
|
||||||
|
|
||||||
bool Nel3DWidget::winEvent( MSG *message, long *result )
|
|
||||||
{
|
|
||||||
if( driver != NULL )
|
|
||||||
{
|
|
||||||
NL3D::IDriver *iDriver = dynamic_cast< NL3D::CDriverUser* >( driver )->getDriver();
|
|
||||||
if( iDriver != NULL )
|
|
||||||
{
|
|
||||||
winProc proc = (winProc)iDriver->getWindowProc();
|
|
||||||
return proc( iDriver, message->hwnd, message->message, message->wParam, message->lParam );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
#elif defined( NL_OS_MAC )
|
|
||||||
|
|
||||||
typedef bool ( *cocoaProc )( NL3D::IDriver *, const void *e );
|
|
||||||
|
|
||||||
bool Nel3DWidget::macEvent( EventHandlerCallRef caller, EventRef event )
|
|
||||||
{
|
|
||||||
if( caller )
|
|
||||||
nlerror( "You are using QtCarbon! Only QtCocoa supported, please upgrade Qt" );
|
|
||||||
|
|
||||||
if( driver != NULL )
|
|
||||||
{
|
|
||||||
NL3D::IDriver *iDriver = dynamic_cast< NL3D::CDriverUser* >( driver )->getDriver();
|
|
||||||
if( iDriver != NULL )
|
|
||||||
{
|
|
||||||
cocoaProc proc = ( cocoaProc )iDriver->getWindowProc();
|
|
||||||
return proc( iDriver, event );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
#elif defined( NL_OS_UNIX )
|
|
||||||
|
|
||||||
typedef bool ( *x11Proc )( NL3D::IDriver *drv, XEvent *e );
|
|
||||||
|
|
||||||
bool Nel3DWidget::x11Event( XEvent *event )
|
|
||||||
{
|
|
||||||
if( driver != NULL )
|
|
||||||
{
|
|
||||||
NL3D::IDriver *iDriver = dynamic_cast< NL3D::CDriverUser* >( driver )->getDriver();
|
|
||||||
if( driver != NULL )
|
|
||||||
{
|
|
||||||
x11Proc proc = ( x11Proc )iDriver->getWindowProc();
|
|
||||||
return proc( iDriver, event );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -1,79 +0,0 @@
|
||||||
// Object Viewer Qt GUI Editor plugin <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef NEL3D_WIDGET_H
|
|
||||||
#define NEL3D_WIDGET_H
|
|
||||||
|
|
||||||
#include <QWidget>
|
|
||||||
#include "nel/misc/types_nl.h"
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
namespace NLGUI
|
|
||||||
{
|
|
||||||
class CEventListener;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace NL3D
|
|
||||||
{
|
|
||||||
class UDriver;
|
|
||||||
class UTextContext;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace GUIEditor
|
|
||||||
{
|
|
||||||
/// Nel 3D interface to Qt
|
|
||||||
class Nel3DWidget : public QWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
Nel3DWidget( QWidget *parent = NULL );
|
|
||||||
virtual ~Nel3DWidget();
|
|
||||||
|
|
||||||
virtual void init();
|
|
||||||
void createTextContext( std::string fontFile );
|
|
||||||
|
|
||||||
NL3D::UDriver* getDriver() const{ return driver; }
|
|
||||||
NL3D::UTextContext* getTextContext() const{ return textContext; }
|
|
||||||
|
|
||||||
|
|
||||||
// Need to return NULL paintengine to Qt so that we can
|
|
||||||
// render the widget normally ourselves, without the image
|
|
||||||
// disappearing when a widget is resized or shown on top of us
|
|
||||||
QPaintEngine* paintEngine() const{ return NULL; }
|
|
||||||
|
|
||||||
public Q_SLOTS:
|
|
||||||
void clear();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
#if defined(NL_OS_WINDOWS)
|
|
||||||
virtual bool winEvent( MSG *message, long *result );
|
|
||||||
#elif defined(NL_OS_MAC)
|
|
||||||
virtual bool macEvent( EventHandlerCallRef caller, EventRef event );
|
|
||||||
#elif defined(NL_OS_UNIX)
|
|
||||||
virtual bool x11Event( XEvent *event );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
private:
|
|
||||||
NL3D::UDriver *driver;
|
|
||||||
NL3D::UTextContext *textContext;
|
|
||||||
NLGUI::CEventListener *eventListener;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -1,173 +0,0 @@
|
||||||
// Object Viewer Qt GUI Editor plugin <http://dev.ryzom.com/projects/ryzom/>
|
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as
|
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
#include "property_browser_ctrl.h"
|
|
||||||
#include "../../3rdparty/qtpropertybrowser/QtVariantPropertyManager"
|
|
||||||
#include "../../3rdparty/qtpropertybrowser/QtTreePropertyBrowser"
|
|
||||||
#include "nel/gui/interface_group.h"
|
|
||||||
#include "nel/gui/widget_manager.h"
|
|
||||||
#include <typeinfo>
|
|
||||||
#include "widget_info_tree.h"
|
|
||||||
|
|
||||||
namespace GUIEditor
|
|
||||||
{
|
|
||||||
CPropBrowserCtrl::CPropBrowserCtrl()
|
|
||||||
{
|
|
||||||
browser = NULL;
|
|
||||||
propertyMgr = new QtVariantPropertyManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
CPropBrowserCtrl::~CPropBrowserCtrl()
|
|
||||||
{
|
|
||||||
delete propertyMgr;
|
|
||||||
propertyMgr = NULL;
|
|
||||||
browser = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CPropBrowserCtrl::setBrowser( QtTreePropertyBrowser *b )
|
|
||||||
{
|
|
||||||
browser = b;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CPropBrowserCtrl::setupWidgetInfo( CWidgetInfoTree *tree )
|
|
||||||
{
|
|
||||||
widgetInfo.clear();
|
|
||||||
|
|
||||||
std::vector< std::string > names;
|
|
||||||
tree->getNames( names );
|
|
||||||
|
|
||||||
std::vector< std::string >::const_iterator itr;
|
|
||||||
for( itr = names.begin(); itr != names.end(); ++itr )
|
|
||||||
{
|
|
||||||
CWidgetInfoTreeNode *node = tree->findNodeByName( *itr );
|
|
||||||
const SWidgetInfo &w = node->getInfo();
|
|
||||||
widgetInfo[ w.GUIName ] = w;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CPropBrowserCtrl::clear()
|
|
||||||
{
|
|
||||||
browser->clear();
|
|
||||||
disconnect( propertyMgr, SIGNAL( propertyChanged( QtProperty* ) ),
|
|
||||||
this, SLOT( onPropertyChanged( QtProperty* ) ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
void CPropBrowserCtrl::onSelectionChanged( std::string &id )
|
|
||||||
{
|
|
||||||
if( browser == NULL )
|
|
||||||
return;
|
|
||||||
|
|
||||||
disconnect( propertyMgr, SIGNAL( propertyChanged( QtProperty* ) ),
|
|
||||||
this, SLOT( onPropertyChanged( QtProperty* ) ) );
|
|
||||||
|
|
||||||
browser->clear();
|
|
||||||
|
|
||||||
CInterfaceElement *e = CWidgetManager::getInstance()->getElementFromId( id );
|
|
||||||
if( e == NULL )
|
|
||||||
{
|
|
||||||
connect( propertyMgr, SIGNAL( propertyChanged( QtProperty* ) ),
|
|
||||||
this, SLOT( onPropertyChanged( QtProperty* ) ) );
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
currentElement = id;
|
|
||||||
|
|
||||||
std::string n = e->getClassName();
|
|
||||||
|
|
||||||
setupProperties( n, e );
|
|
||||||
connect( propertyMgr, SIGNAL( propertyChanged( QtProperty* ) ),
|
|
||||||
this, SLOT( onPropertyChanged( QtProperty* ) ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
void CPropBrowserCtrl::onPropertyChanged( QtProperty *prop )
|
|
||||||
{
|
|
||||||
QString propName = prop->propertyName();
|
|
||||||
QString propValue = prop->valueText();
|
|
||||||
|
|
||||||
// for some reason booleans cannot be extracted from a QtProperty :(
|
|
||||||
if( propValue.isEmpty() )
|
|
||||||
{
|
|
||||||
QtVariantProperty *p = propertyMgr->variantProperty( prop );
|
|
||||||
if( p != NULL )
|
|
||||||
propValue = p->value().toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
CInterfaceElement *e = CWidgetManager::getInstance()->getElementFromId( currentElement );
|
|
||||||
if( e == NULL )
|
|
||||||
return;
|
|
||||||
e->setProperty( propName.toUtf8().constData(), propValue.toUtf8().constData() );
|
|
||||||
|
|
||||||
|
|
||||||
// Make sure the changes are applied
|
|
||||||
bool active = e->getActive();
|
|
||||||
e->setActive( !active );
|
|
||||||
e->setActive( active );
|
|
||||||
}
|
|
||||||
|
|
||||||
void CPropBrowserCtrl::setupProperties( const std::string &type, const CInterfaceElement *element )
|
|
||||||
{
|
|
||||||
std::map< std::string, SWidgetInfo >::iterator itr = widgetInfo.find( type );
|
|
||||||
if( itr == widgetInfo.end() )
|
|
||||||
return;
|
|
||||||
SWidgetInfo &w = itr->second;
|
|
||||||
|
|
||||||
std::vector< SPropEntry >::const_iterator pItr;
|
|
||||||
for( pItr = w.props.begin(); pItr != w.props.end(); ++pItr )
|
|
||||||
{
|
|
||||||
const SPropEntry &prop = *pItr;
|
|
||||||
setupProperty( prop, element );
|
|
||||||
}
|
|
||||||
|
|
||||||
QtVariantEditorFactory *factory = new QtVariantEditorFactory;
|
|
||||||
browser->setFactoryForManager( propertyMgr, factory );
|
|
||||||
}
|
|
||||||
|
|
||||||
void CPropBrowserCtrl::setupProperty( const SPropEntry &prop, const CInterfaceElement *element )
|
|
||||||
{
|
|
||||||
QtVariantProperty *p = NULL;
|
|
||||||
QVariant v;
|
|
||||||
|
|
||||||
if( prop.propType == "string" )
|
|
||||||
{
|
|
||||||
p = propertyMgr->addProperty( QVariant::String, prop.propName.c_str() );
|
|
||||||
v = element->getProperty( prop.propName ).c_str();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if( prop.propType == "bool" )
|
|
||||||
{
|
|
||||||
p = propertyMgr->addProperty( QVariant::Bool, prop.propName.c_str() );
|
|
||||||
bool value = false;
|
|
||||||
NLMISC::fromString( element->getProperty( prop.propName ), value );
|
|
||||||
v = value;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if( prop.propType == "int" )
|
|
||||||
{
|
|
||||||
p = propertyMgr->addProperty( QVariant::Int, prop.propName.c_str() );
|
|
||||||
sint32 value = 0;
|
|
||||||
NLMISC::fromString( element->getProperty( prop.propName ), value );
|
|
||||||
v = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( p == NULL )
|
|
||||||
return;
|
|
||||||
|
|
||||||
p->setValue( v );
|
|
||||||
browser->addProperty( p );
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,195 +0,0 @@
|
||||||
/*
|
|
||||||
Object Viewer Qt
|
|
||||||
Copyright (C) 2010 Dzmitry Kamiahin <dnk-88@tut.by>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "stdpch.h"
|
|
||||||
#include "graphics_viewport.h"
|
|
||||||
|
|
||||||
// STL includes
|
|
||||||
|
|
||||||
// Qt includes
|
|
||||||
#include <QtGui/QAction>
|
|
||||||
#include <QtGui/QResizeEvent>
|
|
||||||
#include <QtGui/QColorDialog>
|
|
||||||
#include <QtGui/QFileDialog>
|
|
||||||
|
|
||||||
// NeL includes
|
|
||||||
#include <nel/misc/rgba.h>
|
|
||||||
|
|
||||||
#include <nel/misc/event_server.h>
|
|
||||||
#include <nel/misc/events.h>
|
|
||||||
|
|
||||||
#include <nel/3d/u_driver.h>
|
|
||||||
#include <nel/3d/driver_user.h>
|
|
||||||
|
|
||||||
// Project includes
|
|
||||||
#include "modules.h"
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
using namespace NL3D;
|
|
||||||
|
|
||||||
namespace NLQT
|
|
||||||
{
|
|
||||||
|
|
||||||
CGraphicsViewport::CGraphicsViewport(QWidget *parent)
|
|
||||||
: QNLWidget(parent)
|
|
||||||
{
|
|
||||||
setAttribute(Qt::WA_OpaquePaintEvent);
|
|
||||||
setAttribute(Qt::WA_NoSystemBackground);
|
|
||||||
setAttribute(Qt::WA_PaintOnScreen);
|
|
||||||
}
|
|
||||||
|
|
||||||
CGraphicsViewport::~CGraphicsViewport()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void CGraphicsViewport::init()
|
|
||||||
{
|
|
||||||
//H_AUTO2
|
|
||||||
nldebug("CGraphicsViewport::init");
|
|
||||||
|
|
||||||
#if defined(NL_OS_UNIX) && !defined(NL_OS_MAC)
|
|
||||||
makeCurrent();
|
|
||||||
#endif // defined(NL_OS_UNIX) && !defined(NL_OS_MAC)
|
|
||||||
|
|
||||||
Modules::objView().init((nlWindow)winId(), width(), height());
|
|
||||||
Modules::psEdit().init();
|
|
||||||
Modules::veget().init();
|
|
||||||
|
|
||||||
setMouseTracking(true);
|
|
||||||
setFocusPolicy(Qt::StrongFocus);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CGraphicsViewport::release()
|
|
||||||
{
|
|
||||||
//H_AUTO2
|
|
||||||
nldebug("CGraphicsViewport::release");
|
|
||||||
|
|
||||||
Modules::veget().release();
|
|
||||||
Modules::psEdit().release();
|
|
||||||
Modules::objView().release();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QAction *CGraphicsViewport::createSaveScreenshotAction(QObject *parent)
|
|
||||||
{
|
|
||||||
QAction *action = new QAction(parent);
|
|
||||||
connect(action, SIGNAL(triggered()), this, SLOT(saveScreenshot()));
|
|
||||||
return action;
|
|
||||||
}
|
|
||||||
|
|
||||||
QAction *CGraphicsViewport::createSetBackgroundColor(QObject *parent)
|
|
||||||
{
|
|
||||||
QAction *action = new QAction(parent);
|
|
||||||
connect(action, SIGNAL(triggered()), this, SLOT(setBackgroundColor()));
|
|
||||||
return action;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CGraphicsViewport::saveScreenshot()
|
|
||||||
{
|
|
||||||
Modules::objView().saveScreenshot("screenshot", false, true, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CGraphicsViewport::setBackgroundColor()
|
|
||||||
{
|
|
||||||
QColor color = QColorDialog::getColor(QColor(Modules::objView().getBackgroundColor().R,
|
|
||||||
Modules::objView().getBackgroundColor().G,
|
|
||||||
Modules::objView().getBackgroundColor().B));
|
|
||||||
if (color.isValid())
|
|
||||||
Modules::objView().setBackgroundColor(NLMISC::CRGBA(color.red(), color.green(), color.blue()));
|
|
||||||
}
|
|
||||||
|
|
||||||
void CGraphicsViewport::resizeEvent(QResizeEvent *resizeEvent)
|
|
||||||
{
|
|
||||||
QWidget::resizeEvent(resizeEvent);
|
|
||||||
if (Modules::objView().getDriver())
|
|
||||||
Modules::objView().setSizeViewport(resizeEvent->size().width(), resizeEvent->size().height());
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(NL_OS_WINDOWS)
|
|
||||||
|
|
||||||
typedef bool (*winProc)(NL3D::IDriver *driver, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
|
|
||||||
|
|
||||||
bool CGraphicsViewport::winEvent(MSG *message, long *result)
|
|
||||||
{
|
|
||||||
if (Modules::objView().getDriver() && Modules::objView().getDriver()->isActive())
|
|
||||||
{
|
|
||||||
NL3D::IDriver *driver = dynamic_cast<NL3D::CDriverUser *>(Modules::objView().getDriver())->getDriver();
|
|
||||||
if (driver)
|
|
||||||
{
|
|
||||||
winProc proc = (winProc)driver->getWindowProc();
|
|
||||||
|
|
||||||
// TODO: shouldn't it return false like the others?
|
|
||||||
// see macEvent() and x11Event() below
|
|
||||||
return proc(driver, message->hwnd, message->message, message->wParam, message->lParam);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
#elif defined(NL_OS_MAC)
|
|
||||||
|
|
||||||
typedef bool (*cocoaProc)(NL3D::IDriver *, const void *e);
|
|
||||||
|
|
||||||
bool CGraphicsViewport::macEvent(EventHandlerCallRef caller, EventRef event)
|
|
||||||
{
|
|
||||||
if(caller)
|
|
||||||
nlerror("You are using QtCarbon! Only QtCocoa supported, please upgrade Qt");
|
|
||||||
|
|
||||||
if (Modules::objView().getDriver() && Modules::objView().getDriver()->isActive())
|
|
||||||
{
|
|
||||||
NL3D::IDriver *driver = dynamic_cast<NL3D::CDriverUser *>(Modules::objView().getDriver())->getDriver();
|
|
||||||
if (driver)
|
|
||||||
{
|
|
||||||
cocoaProc proc = (cocoaProc)driver->getWindowProc();
|
|
||||||
proc(driver, event);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// return false to let Qt handle the event as well,
|
|
||||||
// else the widget would never get focus
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
#elif defined(NL_OS_UNIX)
|
|
||||||
|
|
||||||
typedef bool (*x11Proc)(NL3D::IDriver *drv, XEvent *e);
|
|
||||||
|
|
||||||
bool CGraphicsViewport::x11Event(XEvent *event)
|
|
||||||
{
|
|
||||||
if (Modules::objView().getDriver() && Modules::objView().getDriver()->isActive())
|
|
||||||
{
|
|
||||||
NL3D::IDriver *driver = dynamic_cast<NL3D::CDriverUser *>(Modules::objView().getDriver())->getDriver();
|
|
||||||
if (driver)
|
|
||||||
{
|
|
||||||
x11Proc proc = (x11Proc)driver->getWindowProc();
|
|
||||||
proc(driver, event);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// return false to let Qt handle the event as well,
|
|
||||||
// else the widget would never get focus
|
|
||||||
// TODO: test me please, i have no linux at hand (rti)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} /* namespace NLQT */
|
|
||||||
|
|
|
@ -1,48 +0,0 @@
|
||||||
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR}
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
${LIBXML2_INCLUDE_DIR}
|
|
||||||
${QT_INCLUDES})
|
|
||||||
|
|
||||||
FILE(GLOB SRC *.cpp *.h)
|
|
||||||
SET(OVQT_EXT_SYS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin.h
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin_manager.h
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin_spec.h)
|
|
||||||
|
|
||||||
SET(OVQT_PLUG_SHEET_BUILDER_HDR sheetbuilderconfgdialog.h sheetbuilderdialog.h ovqt_sheet_builder.h)
|
|
||||||
|
|
||||||
SET(QT_USE_QTGUI TRUE)
|
|
||||||
SET(QT_USE_QTOPENGL TRUE)
|
|
||||||
|
|
||||||
QT4_WRAP_CPP(OVQT_PLUG_SHEET_BUILDER_MOC_SRC ${OVQT_PLUG_SHEET_BUILDER_HDR})
|
|
||||||
|
|
||||||
SOURCE_GROUP(QtGeneratedMocSrc FILES ${OVQT_PLUG_SHEET_BUILDER_MOC_SRC})
|
|
||||||
SOURCE_GROUP("Sheet builder Plugin" FILES ${SRC})
|
|
||||||
SOURCE_GROUP("OVQT Extension System" FILES ${OVQT_EXT_SYS_SRC})
|
|
||||||
|
|
||||||
ADD_LIBRARY(ovqt_plugin_sheet_builder MODULE ${SRC} ${OVQT_PLUG_SHEET_BUILDER_MOC_SRC} ${OVQT_EXT_SYS_SRC})
|
|
||||||
|
|
||||||
TARGET_LINK_LIBRARIES(ovqt_plugin_sheet_builder ovqt_plugin_core nelmisc ${QT_LIBRARIES})
|
|
||||||
|
|
||||||
NL_DEFAULT_PROPS(ovqt_plugin_sheet_builder "NeL, Tools, 3D: Object Viewer Qt Plugin: Sheet builder")
|
|
||||||
NL_ADD_RUNTIME_FLAGS(ovqt_plugin_sheet_builder)
|
|
||||||
NL_ADD_LIB_SUFFIX(ovqt_plugin_sheet_builder)
|
|
||||||
|
|
||||||
ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} -DQT_PLUGIN -DQT_SHARED ${QT_DEFINITIONS})
|
|
||||||
|
|
||||||
|
|
||||||
IF(WIN32)
|
|
||||||
IF(WITH_INSTALL_LIBRARIES)
|
|
||||||
INSTALL(TARGETS ovqt_plugin_sheet_builder LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d)
|
|
||||||
ELSE(WITH_INSTALL_LIBRARIES)
|
|
||||||
INSTALL(TARGETS ovqt_plugin_sheet_builder LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d)
|
|
||||||
ENDIF(WITH_INSTALL_LIBRARIES)
|
|
||||||
ELSE(WIN32)
|
|
||||||
IF(WITH_INSTALL_LIBRARIES)
|
|
||||||
INSTALL(TARGETS ovqt_plugin_sheet_builder LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d)
|
|
||||||
ELSE(WITH_INSTALL_LIBRARIES)
|
|
||||||
INSTALL(TARGETS ovqt_plugin_sheet_builder LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d)
|
|
||||||
ENDIF(WITH_INSTALL_LIBRARIES)
|
|
||||||
ENDIF(WIN32)
|
|
||||||
|
|
||||||
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/ovqt_plugin_sheet_builder.xml DESTINATION ${OVQT_PLUGIN_SPECS_DIR} COMPONENT tools3d)
|
|
||||||
|
|
|
@ -612,6 +612,10 @@ static void computeIGBBox(const NL3D::CInstanceGroup &ig, CLightingBBox &result,
|
||||||
{
|
{
|
||||||
nlwarning("Unable to find shape '%s'", it->Name.c_str());
|
nlwarning("Unable to find shape '%s'", it->Name.c_str());
|
||||||
}
|
}
|
||||||
|
else if (toLower (CFile::getExtension (shapePathName)) == "pacs_prim")
|
||||||
|
{
|
||||||
|
nlwarning("EXPORT BUG: Can't read %s (not a shape), should not be part of .ig!", shapePathName.c_str());
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CIFile shapeInputFile;
|
CIFile shapeInputFile;
|
||||||
|
|
|
@ -410,6 +410,12 @@ int main(int argc, char* argv[])
|
||||||
if(group->getInstance(instance).DontCastShadow || group->getInstance(instance).DontCastShadowForExterior)
|
if(group->getInstance(instance).DontCastShadow || group->getInstance(instance).DontCastShadowForExterior)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (toLower (CFile::getExtension (name)) == "pacs_prim")
|
||||||
|
{
|
||||||
|
nlwarning("EXPORT BUG: Can't read %s (not a shape), should not be part of .ig!", name.c_str());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Add a .shape at the end ?
|
// Add a .shape at the end ?
|
||||||
if (!name.empty())
|
if (!name.empty())
|
||||||
{
|
{
|
||||||
|
|
|
@ -202,7 +202,7 @@ static void loadIGFromContinent(NLMISC::CConfigFile ¶meter, std::list<CInsta
|
||||||
// Load the form
|
// Load the form
|
||||||
NLGEORGES::UFormLoader *loader = NLGEORGES::UFormLoader::createLoader();
|
NLGEORGES::UFormLoader *loader = NLGEORGES::UFormLoader::createLoader();
|
||||||
//
|
//
|
||||||
std::string pathName = level_design_world_directory.asString() + "/" + continentName;
|
std::string pathName = CPath::lookup(continentName); // level_design_world_directory.asString() + "/" + continentName;
|
||||||
if (pathName.empty())
|
if (pathName.empty())
|
||||||
{
|
{
|
||||||
nlwarning("Can't find continent form : %s", continentName.c_str());
|
nlwarning("Can't find continent form : %s", continentName.c_str());
|
||||||
|
@ -699,6 +699,12 @@ int main(int argc, char* argv[])
|
||||||
if(group->getInstance(instance).DontCastShadow || group->getInstance(instance).DontCastShadowForExterior)
|
if(group->getInstance(instance).DontCastShadow || group->getInstance(instance).DontCastShadowForExterior)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (toLower (CFile::getExtension (name)) == "pacs_prim")
|
||||||
|
{
|
||||||
|
nlwarning("EXPORT BUG: Can't read %s (not a shape), should not be part of .ig!", name.c_str());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// PS ?
|
// PS ?
|
||||||
if (toLower (CFile::getExtension (name)) == "ps")
|
if (toLower (CFile::getExtension (name)) == "ps")
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -6,9 +6,7 @@ IF(WITH_NEL_TOOLS)
|
||||||
ENDIF(WITH_NEL_TOOLS)
|
ENDIF(WITH_NEL_TOOLS)
|
||||||
|
|
||||||
# Max plugins are under the 3d directory as well.
|
# Max plugins are under the 3d directory as well.
|
||||||
IF(WITH_3D)
|
|
||||||
ADD_SUBDIRECTORY(3d)
|
ADD_SUBDIRECTORY(3d)
|
||||||
ENDIF(WITH_3D)
|
|
||||||
|
|
||||||
# Don't add other subdirectories if only max plugins are selected.
|
# Don't add other subdirectories if only max plugins are selected.
|
||||||
IF(WITH_NEL_TOOLS)
|
IF(WITH_NEL_TOOLS)
|
||||||
|
|
9
code/nel/tools/build_gamedata/all_install_dev.bat
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
title Ryzom Core: 3_install.py
|
||||||
|
3_install.py
|
||||||
|
title Ryzom Core: a1_worldedit_data.py
|
||||||
|
a1_worldedit_data.py
|
||||||
|
title Ryzom Core: b1_client_dev.py
|
||||||
|
b1_client_dev.py
|
||||||
|
title Ryzom Core: b2_shard_data.py
|
||||||
|
b2_shard_data.py
|
||||||
|
title Ryzom Core: Ready
|
|
@ -56,6 +56,7 @@ fn runNelMaxExport inputMaxFile =
|
||||||
|
|
||||||
-- unselect
|
-- unselect
|
||||||
max select none
|
max select none
|
||||||
|
clearSelection()
|
||||||
|
|
||||||
-- Exported object count
|
-- Exported object count
|
||||||
exported = 0
|
exported = 0
|
||||||
|
|
|
@ -36,6 +36,7 @@ fn runNelMaxExport inputMaxFile =
|
||||||
|
|
||||||
-- Select all collision mesh
|
-- Select all collision mesh
|
||||||
max select none
|
max select none
|
||||||
|
clearSelection()
|
||||||
for m in geometry do
|
for m in geometry do
|
||||||
(
|
(
|
||||||
if (isToBeExported m) == true then
|
if (isToBeExported m) == true then
|
||||||
|
|
|
@ -61,6 +61,7 @@ fn runNelMaxExport inputMaxFile =
|
||||||
|
|
||||||
-- unselect
|
-- unselect
|
||||||
max select none
|
max select none
|
||||||
|
clearSelection()
|
||||||
|
|
||||||
-- Exported object count
|
-- Exported object count
|
||||||
exported = 0
|
exported = 0
|
||||||
|
@ -109,6 +110,7 @@ fn runNelMaxExport inputMaxFile =
|
||||||
(
|
(
|
||||||
-- Select none
|
-- Select none
|
||||||
max select none
|
max select none
|
||||||
|
clearSelection()
|
||||||
|
|
||||||
-- Select all node in this ig
|
-- Select all node in this ig
|
||||||
for node in geometry do
|
for node in geometry do
|
||||||
|
|
|
@ -10,6 +10,7 @@ fn runNelMaxExport inputMaxFile =
|
||||||
|
|
||||||
-- Select none
|
-- Select none
|
||||||
max select none
|
max select none
|
||||||
|
clearSelection()
|
||||||
|
|
||||||
-- Select all PACS primitives
|
-- Select all PACS primitives
|
||||||
for i in geometry do
|
for i in geometry do
|
||||||
|
|
|
@ -199,6 +199,7 @@ fn runNelMaxExportSub inputMaxFile retryCount =
|
||||||
|
|
||||||
-- unselect
|
-- unselect
|
||||||
max select none
|
max select none
|
||||||
|
clearSelection()
|
||||||
|
|
||||||
-- Exported object count
|
-- Exported object count
|
||||||
exported = 0
|
exported = 0
|
||||||
|
|
|
@ -46,6 +46,7 @@ fn runNelMaxExport inputMaxFile =
|
||||||
|
|
||||||
-- unselect
|
-- unselect
|
||||||
max select none
|
max select none
|
||||||
|
clearSelection()
|
||||||
|
|
||||||
-- Exported object count
|
-- Exported object count
|
||||||
exported = 0
|
exported = 0
|
||||||
|
|
|
@ -40,6 +40,7 @@ fn runNelMaxExport inputMaxFile =
|
||||||
|
|
||||||
-- Select none
|
-- Select none
|
||||||
max select none
|
max select none
|
||||||
|
clearSelection()
|
||||||
|
|
||||||
-- Found it ?
|
-- Found it ?
|
||||||
find = false
|
find = false
|
||||||
|
|
|
@ -122,6 +122,7 @@ fn runNelMaxExport inputMaxFile =
|
||||||
|
|
||||||
-- unselect
|
-- unselect
|
||||||
max select none
|
max select none
|
||||||
|
clearSelection()
|
||||||
|
|
||||||
-- Exported object count
|
-- Exported object count
|
||||||
exported = 0
|
exported = 0
|
||||||
|
|
|
@ -127,6 +127,7 @@ fn runNelMaxExport inputMaxFile =
|
||||||
|
|
||||||
-- unselect
|
-- unselect
|
||||||
max select none
|
max select none
|
||||||
|
clearSelection()
|
||||||
|
|
||||||
-- Exported object count
|
-- Exported object count
|
||||||
exported = 0
|
exported = 0
|
||||||
|
@ -175,6 +176,7 @@ fn runNelMaxExport inputMaxFile =
|
||||||
(
|
(
|
||||||
-- Select none
|
-- Select none
|
||||||
max select none
|
max select none
|
||||||
|
clearSelection()
|
||||||
|
|
||||||
-- Select all node in this ig
|
-- Select all node in this ig
|
||||||
for node in geometry do
|
for node in geometry do
|
||||||
|
|
|
@ -228,6 +228,7 @@ fn exportCollisionsFromZone outputNelDir filename =
|
||||||
(
|
(
|
||||||
-- Select all collision mesh
|
-- Select all collision mesh
|
||||||
max select none
|
max select none
|
||||||
|
clearSelection()
|
||||||
for m in geometry do
|
for m in geometry do
|
||||||
(
|
(
|
||||||
if (isToBeExportedCollision m) == true then
|
if (isToBeExportedCollision m) == true then
|
||||||
|
@ -311,6 +312,7 @@ fn exportInstanceGroupFromZone inputFile outputPath igName transitionZone cellSi
|
||||||
|
|
||||||
-- unselect
|
-- unselect
|
||||||
max select none
|
max select none
|
||||||
|
clearSelection()
|
||||||
|
|
||||||
-- Exported object count
|
-- Exported object count
|
||||||
exported = 0
|
exported = 0
|
||||||
|
@ -372,6 +374,7 @@ fn exportInstanceGroupFromZone inputFile outputPath igName transitionZone cellSi
|
||||||
(
|
(
|
||||||
-- Select none
|
-- Select none
|
||||||
max select none
|
max select none
|
||||||
|
clearSelection()
|
||||||
|
|
||||||
for node in objects where classOf node == XRefObject do
|
for node in objects where classOf node == XRefObject do
|
||||||
(
|
(
|
||||||
|
|
|
@ -76,6 +76,7 @@ fn runNelMaxExport inputMaxFile =
|
||||||
|
|
||||||
-- Select none
|
-- Select none
|
||||||
max select none
|
max select none
|
||||||
|
clearSelection()
|
||||||
|
|
||||||
-- Select all PACS primitives
|
-- Select all PACS primitives
|
||||||
for i in geometry do
|
for i in geometry do
|
||||||
|
|
|
@ -102,6 +102,7 @@ fn runNelMaxExport inputMaxFile =
|
||||||
|
|
||||||
-- Select all collision mesh
|
-- Select all collision mesh
|
||||||
max select none
|
max select none
|
||||||
|
clearSelection()
|
||||||
for m in geometry do
|
for m in geometry do
|
||||||
(
|
(
|
||||||
if (isToBeExported m) == true then
|
if (isToBeExported m) == true then
|
||||||
|
|
|
@ -69,6 +69,7 @@ if BuildShadowSkinEnabled:
|
||||||
printLog(log, ">>> Setup build directories <<<")
|
printLog(log, ">>> Setup build directories <<<")
|
||||||
mkPath(log, ExportBuildDirectory + "/" + ShapeClodtexBuildDirectory)
|
mkPath(log, ExportBuildDirectory + "/" + ShapeClodtexBuildDirectory)
|
||||||
mkPath(log, ExportBuildDirectory + "/" + ShapeWithCoarseMeshBuildDirectory)
|
mkPath(log, ExportBuildDirectory + "/" + ShapeWithCoarseMeshBuildDirectory)
|
||||||
|
mkPath(log, ExportBuildDirectory + "/" + ShapeOptimizedBuildDirectory)
|
||||||
mkPath(log, ExportBuildDirectory + "/" + ShapeLightmapBuildDirectory)
|
mkPath(log, ExportBuildDirectory + "/" + ShapeLightmapBuildDirectory)
|
||||||
mkPath(log, ExportBuildDirectory + "/" + ShapeLightmap16BitsBuildDirectory)
|
mkPath(log, ExportBuildDirectory + "/" + ShapeLightmap16BitsBuildDirectory)
|
||||||
|
|
||||||
|
|
|
@ -77,16 +77,19 @@ else:
|
||||||
# copy lightmap_not_optimized to lightmap
|
# copy lightmap_not_optimized to lightmap
|
||||||
printLog(log, ">>> Optimize lightmaps <<<")
|
printLog(log, ">>> Optimize lightmaps <<<")
|
||||||
loPathLightmapsOriginal = ExportBuildDirectory + "/" + ShapeLightmapNotOptimizedExportDirectory
|
loPathLightmapsOriginal = ExportBuildDirectory + "/" + ShapeLightmapNotOptimizedExportDirectory
|
||||||
|
loPathShapesOriginal = ExportBuildDirectory + "/" + ShapeClodtexBuildDirectory
|
||||||
mkPath(log, loPathLightmapsOriginal)
|
mkPath(log, loPathLightmapsOriginal)
|
||||||
loPathLightmaps = ExportBuildDirectory + "/" + ShapeLightmapBuildDirectory
|
loPathLightmaps = ExportBuildDirectory + "/" + ShapeLightmapBuildDirectory
|
||||||
loPathShapes = ExportBuildDirectory + "/" + ShapeClodtexBuildDirectory
|
loPathShapes = ExportBuildDirectory + "/" + ShapeOptimizedBuildDirectory
|
||||||
loPathTags = ExportBuildDirectory + "/" + ShapeTagExportDirectory
|
loPathTags = ExportBuildDirectory + "/" + ShapeTagExportDirectory
|
||||||
mkPath(log, loPathLightmaps)
|
mkPath(log, loPathLightmaps)
|
||||||
mkPath(log, loPathShapes)
|
mkPath(log, loPathShapes)
|
||||||
mkPath(log, loPathTags)
|
mkPath(log, loPathTags)
|
||||||
if needUpdateDirByTagLog(log, loPathLightmapsOriginal, ".txt", loPathLightmaps, ".txt") or needUpdateDirNoSubdir(log, loPathLightmapsOriginal, loPathLightmaps) or needUpdateDirNoSubdir(log, loPathShapes, loPathLightmaps) or needUpdateDirNoSubdir(log, loPathTags, loPathLightmaps):
|
if needUpdateDirByTagLog(log, loPathLightmapsOriginal, ".txt", loPathLightmaps, ".txt") or needUpdateDirNoSubdir(log, loPathLightmapsOriginal, loPathLightmaps) or needUpdateDirNoSubdir(log, loPathShapesOriginal, loPathShapes) or needUpdateDirNoSubdir(log, loPathShapes, loPathLightmaps) or needUpdateDirNoSubdir(log, loPathTags, loPathLightmaps):
|
||||||
removeFilesRecursive(log, loPathLightmaps)
|
removeFilesRecursive(log, loPathLightmaps)
|
||||||
copyFiles(log, loPathLightmapsOriginal, loPathLightmaps)
|
copyFiles(log, loPathLightmapsOriginal, loPathLightmaps)
|
||||||
|
removeFilesRecursive(log, loPathShapes)
|
||||||
|
copyFiles(log, loPathShapesOriginal, loPathShapes)
|
||||||
# Optimize lightmaps if any. Additionnaly, output a file indicating which lightmaps are 8 bits
|
# Optimize lightmaps if any. Additionnaly, output a file indicating which lightmaps are 8 bits
|
||||||
# lightmap_optimizer <path_lightmaps> <path_shapes> [path_tags] [path_flag8bit]
|
# lightmap_optimizer <path_lightmaps> <path_shapes> [path_tags] [path_flag8bit]
|
||||||
subprocess.call([ LightmapOptimizer, loPathLightmaps, loPathShapes, loPathTags, ExportBuildDirectory + "/" + ShapeLightmapBuildDirectory + "/list_lm_8bit.txt" ])
|
subprocess.call([ LightmapOptimizer, loPathLightmaps, loPathShapes, loPathTags, ExportBuildDirectory + "/" + ShapeLightmapBuildDirectory + "/list_lm_8bit.txt" ])
|
||||||
|
|
|
@ -46,8 +46,8 @@ printLog(log, "")
|
||||||
printLog(log, ">>> Install shape <<<")
|
printLog(log, ">>> Install shape <<<")
|
||||||
installPath = InstallDirectory + "/" + ShapeInstallDirectory
|
installPath = InstallDirectory + "/" + ShapeInstallDirectory
|
||||||
mkPath(log, installPath)
|
mkPath(log, installPath)
|
||||||
mkPath(log, ExportBuildDirectory + "/" + ShapeClodtexBuildDirectory)
|
mkPath(log, ExportBuildDirectory + "/" + ShapeOptimizedBuildDirectory)
|
||||||
copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + ShapeClodtexBuildDirectory, installPath, ".shape")
|
copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + ShapeOptimizedBuildDirectory, installPath, ".shape")
|
||||||
mkPath(log, ExportBuildDirectory + "/" + ShapeWithCoarseMeshBuildDirectory)
|
mkPath(log, ExportBuildDirectory + "/" + ShapeWithCoarseMeshBuildDirectory)
|
||||||
copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + ShapeWithCoarseMeshBuildDirectory, installPath, ".shape")
|
copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + ShapeWithCoarseMeshBuildDirectory, installPath, ".shape")
|
||||||
copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + ShapeWithCoarseMeshBuildDirectory, installPath, ".dds")
|
copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + ShapeWithCoarseMeshBuildDirectory, installPath, ".dds")
|
||||||
|
|
|
@ -265,6 +265,7 @@ fn runNelMaxExportSub inputMaxFile retryCount =
|
||||||
|
|
||||||
-- unselect
|
-- unselect
|
||||||
max select none
|
max select none
|
||||||
|
clearSelection()
|
||||||
|
|
||||||
-- Exported object count
|
-- Exported object count
|
||||||
exported = 0
|
exported = 0
|
||||||
|
|
|
@ -112,6 +112,7 @@ fn runNelMaxExport inputMaxFile =
|
||||||
|
|
||||||
-- unselect
|
-- unselect
|
||||||
max select none
|
max select none
|
||||||
|
clearSelection()
|
||||||
|
|
||||||
-- Exported object count
|
-- Exported object count
|
||||||
exported = 0
|
exported = 0
|
||||||
|
|
|
@ -103,6 +103,7 @@ fn runNelMaxExport inputMaxFile =
|
||||||
|
|
||||||
-- Select none
|
-- Select none
|
||||||
max select none
|
max select none
|
||||||
|
clearSelection()
|
||||||
|
|
||||||
-- Found it ?
|
-- Found it ?
|
||||||
find = false
|
find = false
|
||||||
|
|
|
@ -55,6 +55,7 @@ for dir in WaterMapSourceDirectories:
|
||||||
destDir = DatabaseDirectory + "/" + dir
|
destDir = DatabaseDirectory + "/" + dir
|
||||||
mkPath(log, destDir)
|
mkPath(log, destDir)
|
||||||
copyFilesExtNoTreeIfNeeded(log, srcDir, destDir, ".tga")
|
copyFilesExtNoTreeIfNeeded(log, srcDir, destDir, ".tga")
|
||||||
|
copyFilesExtNoTreeIfNeeded(log, srcDir, destDir, ".png")
|
||||||
printLog(log, "")
|
printLog(log, "")
|
||||||
|
|
||||||
log.close()
|
log.close()
|
||||||
|
|
|
@ -1 +1,9 @@
|
||||||
SUBDIRS(build_ig_boxes build_indoor_rbank build_rbank)
|
IF(WITH_3D)
|
||||||
|
ADD_SUBDIRECTORY(build_ig_boxes)
|
||||||
|
|
||||||
|
IF(WITH_LIGO)
|
||||||
|
ADD_SUBDIRECTORY(build_rbank)
|
||||||
|
ENDIF()
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
ADD_SUBDIRECTORY(build_indoor_rbank)
|
||||||
|
|
118
code/ryzom/tools/server/ryzom_ams/www/config.php
Normal file
|
@ -0,0 +1,118 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* This file contains all variables needed by other php scripts.
|
||||||
|
* @author Daan Janssens, mentored by Matthew Lagoe
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Variables for database access to the www/CMS database
|
||||||
|
$cfg['db']['web']['host'] = 'localhost';
|
||||||
|
$cfg['db']['web']['port'] = '3306';
|
||||||
|
$cfg['db']['web']['name'] = 'ryzom_ams';
|
||||||
|
$cfg['db']['web']['user'] = 'shard';
|
||||||
|
$cfg['db']['web']['pass'] = '';
|
||||||
|
|
||||||
|
// Variables for database access to the lib database
|
||||||
|
$cfg['db']['lib']['host'] = 'localhost';
|
||||||
|
$cfg['db']['lib']['port'] = '3306';
|
||||||
|
$cfg['db']['lib']['name'] = 'ryzom_ams_lib';
|
||||||
|
$cfg['db']['lib']['user'] = 'shard';
|
||||||
|
$cfg['db']['lib']['pass'] = '';
|
||||||
|
|
||||||
|
// Variables for database access to the shard database
|
||||||
|
$cfg['db']['shard']['host'] = 'localhost';
|
||||||
|
$cfg['db']['shard']['port'] = '3306';
|
||||||
|
$cfg['db']['shard']['name'] = 'nel';
|
||||||
|
$cfg['db']['shard']['user'] = 'shard';
|
||||||
|
$cfg['db']['shard']['pass'] = '';
|
||||||
|
|
||||||
|
// Variables for database access to the ring_open database
|
||||||
|
$cfg['db']['ring']['host'] = 'localhost';
|
||||||
|
$cfg['db']['ring']['port'] = '3306';
|
||||||
|
$cfg['db']['ring']['name'] = 'ring_open';
|
||||||
|
$cfg['db']['ring']['user'] = 'shard';
|
||||||
|
$cfg['db']['ring']['pass'] = '';
|
||||||
|
|
||||||
|
// Variables for database access to the nel_tool database
|
||||||
|
$cfg['db']['tool']['host'] = 'localhost';
|
||||||
|
$cfg['db']['tool']['port'] = '3306';
|
||||||
|
$cfg['db']['tool']['name'] = 'nel_tool';
|
||||||
|
$cfg['db']['tool']['user'] = 'shard';
|
||||||
|
$cfg['db']['tool']['pass'] = '';
|
||||||
|
|
||||||
|
// To connect to an IMAP server running on port 143 on the local machine,
|
||||||
|
// do the following: $mbox = imap_open("{localhost:143}INBOX", "user_id", "password");
|
||||||
|
// POP3 server on port 110: $mbox = imap_open ("{localhost:110/pop3}INBOX", "user_id", "password");
|
||||||
|
// SSL IMAP or POP3 server, add /ssl after the protocol: $mbox = imap_open ("{localhost:993/imap/ssl}INBOX", "user_id", "password");
|
||||||
|
// To connect to an SSL IMAP or POP3 server with a self-signed certificate,
|
||||||
|
// add /ssl/novalidate-cert after the protocol specification:
|
||||||
|
// $mbox = imap_open ("{localhost:995/pop3/ssl/novalidate-cert}", "user_id", "password");
|
||||||
|
// NNTP server on port 119 use: $nntp = imap_open ("{localhost:119/nntp}comp.test", "", "");
|
||||||
|
// To connect to a remote server replace "localhost" with the name or the IP address of the server you want to connect to.
|
||||||
|
//$cfg['mail']['server'] = '{localhost:110/pop3/novalidate-cert}INBOX';
|
||||||
|
|
||||||
|
//imap connection string as explained above
|
||||||
|
$cfg['mail']['default_mailserver']= '{imap.gmail.com:993/imap/ssl}INBOX';
|
||||||
|
//groupemail is the email that sends the email
|
||||||
|
$cfg['mail']['default_groupemail'] = 'example@gmail.com';
|
||||||
|
//groupname will be the name displayed as sender
|
||||||
|
$cfg['mail']['default_groupname'] = 'Ryzomcore Support';
|
||||||
|
//the username of the account
|
||||||
|
$cfg['mail']['default_username'] = 'example@gmail.com';
|
||||||
|
//the matching password
|
||||||
|
$cfg['mail']['default_password'] = 'passw0rd';
|
||||||
|
//the host, being used when a mail is sent from a support group: support_groups_name@host
|
||||||
|
$cfg['mail']['host'] = "ryzomcore.com";
|
||||||
|
|
||||||
|
//Defines mailing related stuff
|
||||||
|
$SUPPORT_GROUP_IMAP_CRYPTKEY = "azerty";
|
||||||
|
$TICKET_MAILING_SUPPORT = false;
|
||||||
|
|
||||||
|
//You have to create this dir at first!
|
||||||
|
//The incoming emails will be backed up here and the log file keeps track of the mail_cron job.
|
||||||
|
$MAIL_DIR = "/home/username/mail";
|
||||||
|
$MAIL_LOG_PATH = "/home/username/mail/cron_mail.log";
|
||||||
|
|
||||||
|
//terms of service url location
|
||||||
|
$TOS_URL ="http://www.gnu.org/licenses/agpl-3.0.html";
|
||||||
|
|
||||||
|
//crypt is being used by encrypting & decrypting of the IMAP password of the supportgroups
|
||||||
|
$cfg['crypt']['key'] = 'Sup3rS3cr3tStuff';
|
||||||
|
$cfg['crypt']['enc_method'] = 'AES-256-CBC';
|
||||||
|
$cfg['crypt']['hash_method'] = "SHA512";
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------------------
|
||||||
|
// If true= the server will add automatically unknown user in the database
|
||||||
|
// (in nel.user= nel.permission= ring.ring_user and ring.characters
|
||||||
|
$ALLOW_UNKNOWN = true ;
|
||||||
|
// if true= the login service automaticaly create a ring user and a editor character if needed
|
||||||
|
$CREATE_RING = true ;
|
||||||
|
|
||||||
|
// site paths definitions (you shouldn't have to edit these..)
|
||||||
|
$AMS_LIB = dirname( dirname( __FILE__ ) ) . '/ams_lib';
|
||||||
|
$AMS_TRANS = $AMS_LIB . '/translations';
|
||||||
|
$AMS_CACHEDIR = $AMS_LIB . '/cache';
|
||||||
|
//Here your inc and func resides
|
||||||
|
$SITEBASE = dirname( __FILE__ ) . '/html/' ;
|
||||||
|
|
||||||
|
//the paths to your website url
|
||||||
|
$BASE_WEBPATH = '';
|
||||||
|
$IMAGELOC_WEBPATH = $BASE_WEBPATH.'img';
|
||||||
|
$WEBPATH = $BASE_WEBPATH . '/index.php';
|
||||||
|
$INGAME_WEBPATH = $BASE_WEBPATH . '/index.php';
|
||||||
|
$CONFIG_PATH = dirname( __FILE__ );
|
||||||
|
|
||||||
|
//defines the default language
|
||||||
|
$DEFAULT_LANGUAGE = 'en';
|
||||||
|
|
||||||
|
//defines if logging actions should happen or not.
|
||||||
|
$TICKET_LOGGING = true;
|
||||||
|
|
||||||
|
//defines the time format display
|
||||||
|
$TIME_FORMAT = "m-d-Y H:i:s";
|
||||||
|
|
||||||
|
//defines which ingame layout template should be used
|
||||||
|
$INGAME_LAYOUT = "basic";
|
||||||
|
|
||||||
|
//forces to load the ingame templates if set to true
|
||||||
|
$FORCE_INGAME = false;
|
||||||
|
|
0
code/ryzom/tools/server/ryzom_ams/www/is_installed
Normal file
|
@ -16,9 +16,9 @@ ELSEIF(APPLE)
|
||||||
SET(OVQT_PLUGIN_DIR "plugins")
|
SET(OVQT_PLUGIN_DIR "plugins")
|
||||||
SET(OVQT_DATA_DIR ".")
|
SET(OVQT_DATA_DIR ".")
|
||||||
ELSE(WIN32)
|
ELSE(WIN32)
|
||||||
SET(OVQT_PLUGIN_SPECS_DIR ${NL_SHARE_PREFIX}/object_viewer_qt/plugins)
|
SET(OVQT_PLUGIN_SPECS_DIR ${NL_SHARE_PREFIX}/studio/plugins)
|
||||||
SET(OVQT_PLUGIN_DIR ${NL_LIB_PREFIX}/object_viewer_qt)
|
SET(OVQT_PLUGIN_DIR ${NL_LIB_PREFIX}/studio)
|
||||||
SET(OVQT_DATA_DIR ${NL_SHARE_PREFIX}/object_viewer_qt/data)
|
SET(OVQT_DATA_DIR ${NL_SHARE_PREFIX}/studio/data)
|
||||||
|
|
||||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/ovqt_config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/ovqt_config.h)
|
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/ovqt_config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/ovqt_config.h)
|
||||||
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
|
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
@ -27,7 +27,7 @@ ELSE(WIN32)
|
||||||
ENDIF(WIN32)
|
ENDIF(WIN32)
|
||||||
|
|
||||||
IF(UNIX AND WITH_STATIC)
|
IF(UNIX AND WITH_STATIC)
|
||||||
MESSAGE(FATAL_ERROR "OVQT does not work with static NeL builds on Unix atm.")
|
MESSAGE(FATAL_ERROR "Studio does not work with static NeL builds on Unix atm.")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
ADD_SUBDIRECTORY(src)
|
ADD_SUBDIRECTORY(src)
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 131 KiB After Width: | Height: | Size: 131 KiB |
Before Width: | Height: | Size: 187 KiB After Width: | Height: | Size: 187 KiB |
7
code/studio/ovqt_config.h.cmake
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
#ifndef OVQT_CONFIG_H
|
||||||
|
#define OVQT_CONFIG_H
|
||||||
|
|
||||||
|
#define DATA_DIR "${NL_SHARE_ABSOLUTE_PREFIX}/studio"
|
||||||
|
#define PLUGINS_DIR "${NL_LIB_ABSOLUTE_PREFIX}/studio"
|
||||||
|
|
||||||
|
#endif
|
|
@ -96,3 +96,5 @@ ADD_DEFINITIONS(-DQT_SHARED)
|
||||||
NL_DEFAULT_PROPS(qt_property_browser "3rdParty: Qt Property Browser 2.5")
|
NL_DEFAULT_PROPS(qt_property_browser "3rdParty: Qt Property Browser 2.5")
|
||||||
NL_ADD_RUNTIME_FLAGS(qt_property_browser)
|
NL_ADD_RUNTIME_FLAGS(qt_property_browser)
|
||||||
NL_ADD_LIB_SUFFIX(qt_property_browser)
|
NL_ADD_LIB_SUFFIX(qt_property_browser)
|
||||||
|
|
||||||
|
INSTALL(TARGETS qt_property_browser LIBRARY DESTINATION ${NL_LIB_PREFIX} ARCHIVE DESTINATION ${NL_LIB_PREFIX} COMPONENT libraries)
|