2b3574cefc
- ricompilazione per passaggio a C++ 20 - modifiche a funzioni exe/lua SetLevel e SetMode per ricevere un vettore di Id.
851 lines
23 KiB
C++
851 lines
23 KiB
C++
//----------------------------------------------------------------------------
|
|
// EgalTech 2014-2014
|
|
//----------------------------------------------------------------------------
|
|
// File : LUA_GdbObjAttribs.cpp Data : 30.09.14 Versione : 1.5i5
|
|
// Contenuto : Funzioni di trasformazione geometrica per LUA.
|
|
//
|
|
//
|
|
//
|
|
// Modifiche : 30.09.14 DS Creazione modulo.
|
|
//
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
|
|
//--------------------------- Include ----------------------------------------
|
|
#include "stdafx.h"
|
|
#include "LUA.h"
|
|
#include "/EgtDev/Include/EXeExecutor.h"
|
|
#include "/EgtDev/Include/EXeConst.h"
|
|
#include "/EgtDev/Include/EGkGdbConst.h"
|
|
#include "/EgtDev/Include/EGkLuaAux.h"
|
|
#include "/EgtDev/Include/EGnStringUtils.h"
|
|
|
|
using namespace std ;
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaCopyAttributes( lua_State* L)
|
|
{
|
|
// 2 parametri : nSouId, nDestId
|
|
int nSouId ;
|
|
LuaCheckParam( L, 1, nSouId)
|
|
int nDestId ;
|
|
LuaCheckParam( L, 2, nDestId)
|
|
// copio gli attributri
|
|
bool bOk = ExeCopyAttributes( nSouId, nDestId) ;
|
|
// restituisco il risultato
|
|
LuaSetParam( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaSetLevel( lua_State* L)
|
|
{
|
|
// 2 parametri : Ids, nLevel
|
|
INTVECTOR vId ;
|
|
LuaCheckParam( L, 1, vId)
|
|
int nLevel ;
|
|
LuaCheckParam( L, 2, nLevel)
|
|
// imposto lo stato
|
|
bool bOk = ExeSetLevel( vId, nLevel) ;
|
|
// restituisco il risultato
|
|
LuaSetParam( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaRevertLevel( lua_State* L)
|
|
{
|
|
// 1 parametro : nId
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
LuaClearStack( L) ;
|
|
// porto il livello al valore precedente
|
|
bool bOk = ExeRevertLevel( nId) ;
|
|
// restituisco il risultato
|
|
LuaSetParam( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaGetLevel( lua_State* L)
|
|
{
|
|
// 1 parametro : nId
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
LuaClearStack( L) ;
|
|
// recupero il livello
|
|
int nLevel ;
|
|
bool bOk = ExeGetLevel( nId, &nLevel) ;
|
|
// restituisco il risultato
|
|
if ( bOk)
|
|
LuaSetParam( L, nLevel) ;
|
|
else
|
|
LuaSetParam( L) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaGetCalcLevel( lua_State* L)
|
|
{
|
|
// 1 parametro : nId
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
LuaClearStack( L) ;
|
|
// recupero il livello
|
|
int nLevel ;
|
|
bool bOk = ExeGetCalcLevel( nId, &nLevel) ;
|
|
// restituisco il risultato
|
|
if ( bOk)
|
|
LuaSetParam( L, nLevel) ;
|
|
else
|
|
LuaSetParam( L) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaSetMode( lua_State* L)
|
|
{
|
|
// 2 parametri : Ids, nMode
|
|
INTVECTOR vId ;
|
|
LuaCheckParam( L, 1, vId)
|
|
int nMode ;
|
|
LuaCheckParam( L, 2, nMode)
|
|
LuaClearStack( L) ;
|
|
// imposto il modo
|
|
bool bOk = ExeSetMode( vId, nMode) ;
|
|
// restituisco il risultato
|
|
LuaSetParam( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaRevertMode( lua_State* L)
|
|
{
|
|
// 1 parametro : Id
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
LuaClearStack( L) ;
|
|
// porto il modo al valore precedente
|
|
bool bOk = ExeRevertMode( nId) ;
|
|
// restituisco il risultato
|
|
LuaSetParam( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaGetMode( lua_State* L)
|
|
{
|
|
// 1 parametro : Id
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
LuaClearStack( L) ;
|
|
// recupero il modo
|
|
int nMode ;
|
|
if ( ExeGetMode( nId, &nMode))
|
|
// restituisco il risultato
|
|
LuaSetParam( L, nMode) ;
|
|
else
|
|
LuaSetParam( L) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaGetCalcMode( lua_State* L)
|
|
{
|
|
// 1 parametro : Id
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
LuaClearStack( L) ;
|
|
// recupero il modo calcolato (ovvero proprio ed ereditato)
|
|
int nMode ;
|
|
if ( ExeGetCalcMode( nId, &nMode))
|
|
// restituisco il risultato
|
|
LuaSetParam( L, nMode) ;
|
|
else
|
|
LuaSetParam( L) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaSetStatus( lua_State* L)
|
|
{
|
|
// 2 parametri : Ids, nStatus
|
|
INTVECTOR vId ;
|
|
LuaCheckParam( L, 1, vId)
|
|
int nStatus ;
|
|
LuaCheckParam( L, 2, nStatus)
|
|
LuaClearStack( L) ;
|
|
// imposto lo stato
|
|
bool bOk = ExeSetStatus( vId, nStatus) ;
|
|
// restituisco il risultato
|
|
LuaSetParam( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaRevertStatus( lua_State* L)
|
|
{
|
|
// 1 parametro : Id
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
LuaClearStack( L) ;
|
|
// porto lo stato al valore precedente
|
|
bool bOk = ExeRevertStatus( nId) ;
|
|
// restituisco il risultato
|
|
LuaSetParam( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaGetStatus( lua_State* L)
|
|
{
|
|
// 1 parametro : Id
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
LuaClearStack( L) ;
|
|
// recupero lo stato
|
|
int nStatus ;
|
|
if ( ExeGetStatus( nId, &nStatus))
|
|
// restituisco il risultato
|
|
LuaSetParam( L, nStatus) ;
|
|
else
|
|
LuaSetParam( L) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaGetCalcStatus( lua_State* L)
|
|
{
|
|
// 1 parametro : Id
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
LuaClearStack( L) ;
|
|
// recupero lo stato
|
|
int nStatus ;
|
|
if ( ExeGetCalcStatus( nId, &nStatus))
|
|
// restituisco il risultato
|
|
LuaSetParam( L, nStatus) ;
|
|
else
|
|
LuaSetParam( L) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaSetMark( lua_State* L)
|
|
{
|
|
// 1 o 2 parametri : Id [, nMark]
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
int nMark = 1 ;
|
|
LuaGetParam( L, 2, nMark) ;
|
|
LuaClearStack( L) ;
|
|
// imposto l'evidenziazione
|
|
bool bOk = ExeSetMark( nId, nMark) ;
|
|
// restituisco il risultato
|
|
LuaSetParam( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaResetMark( lua_State* L)
|
|
{
|
|
// 1 parametro : Id
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
LuaClearStack( L) ;
|
|
// cancello l'evidenziazione
|
|
bool bOk = ExeResetMark( nId) ;
|
|
// restituisco il risultato
|
|
LuaSetParam( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaGetMark( lua_State* L)
|
|
{
|
|
// 1 parametro : Id
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
LuaClearStack( L) ;
|
|
// recupero lo stato di evidenziazione
|
|
BOOL nMark ;
|
|
if ( ExeGetMark( nId, &nMark))
|
|
// restituisco il risultato
|
|
LuaSetParam( L, ( nMark != GDB_MK_OFF)) ;
|
|
else
|
|
LuaSetParam( L) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaGetCalcMark( lua_State* L)
|
|
{
|
|
// 1 parametro : Id
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
LuaClearStack( L) ;
|
|
// recupero lo stato calcolato di evidenziazione
|
|
BOOL nMark ;
|
|
if ( ExeGetCalcMark( nId, &nMark))
|
|
// restituisco il risultato
|
|
LuaSetParam( L, ( nMark != GDB_MK_OFF)) ;
|
|
else
|
|
LuaSetParam( L) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaStdColor( lua_State* L)
|
|
{
|
|
// 1 parametro : Nome
|
|
string sName ;
|
|
LuaCheckParam( L, 1, sName)
|
|
LuaClearStack( L) ;
|
|
// recupero il colore con il nome indicato
|
|
Color cCol ;
|
|
if ( ExeStdColor( sName, cCol)) {
|
|
// restituisco il risultato
|
|
LuaSetParam( L, cCol) ;
|
|
}
|
|
else
|
|
LuaSetParam( L) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaSetColor( lua_State* L)
|
|
{
|
|
// 2 o 3 parametri : Id/s, Colore [, bSetAlpha]
|
|
INTVECTOR vId ;
|
|
LuaCheckParam( L, 1, vId)
|
|
Color cCol ;
|
|
if ( ! LuaGetParam( L, 2, cCol)) {
|
|
string sColName ;
|
|
LuaCheckParam( L, 2, sColName)
|
|
if ( ! ExeStdColor( sColName, cCol))
|
|
return luaL_error( L, " Invalid Parameter # 2") ;
|
|
}
|
|
bool bSetAlpha = true ;
|
|
LuaGetParam( L, 3, bSetAlpha) ;
|
|
LuaClearStack( L) ;
|
|
// assegno il colore
|
|
bool bOk = ExeSetColor( vId, cCol, bSetAlpha) ;
|
|
// restituisco il risultato
|
|
LuaSetParam( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaSetAlpha( lua_State* L)
|
|
{
|
|
// 2 : Id/s, nAlpha
|
|
INTVECTOR vId ;
|
|
LuaCheckParam( L, 1, vId)
|
|
int nAlpha ;
|
|
LuaCheckParam( L, 2, nAlpha)
|
|
LuaClearStack( L) ;
|
|
// assegno la trasparenza
|
|
bool bOk = ExeSetAlpha( vId, nAlpha) ;
|
|
// restituisco il risultato
|
|
LuaSetParam( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaResetColor( lua_State* L)
|
|
{
|
|
// 1 parametro : Id/s
|
|
INTVECTOR vId ;
|
|
LuaCheckParam( L, 1, vId)
|
|
LuaClearStack( L) ;
|
|
// tolgo il colore
|
|
bool bOk = ExeResetColor( vId) ;
|
|
// restituisco il risultato
|
|
LuaSetParam( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaGetColor( lua_State* L)
|
|
{
|
|
// 1 parametro : Id
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
LuaClearStack( L) ;
|
|
// recupero il colore
|
|
Color cCol ;
|
|
if ( ExeGetColor( nId, cCol)) {
|
|
// restituisco il risultato
|
|
LuaSetParam( L, cCol) ;
|
|
}
|
|
else
|
|
LuaSetParam( L) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaGetCalcColor( lua_State* L)
|
|
{
|
|
// 1 parametro : Id
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
LuaClearStack( L) ;
|
|
// recupero il colore
|
|
Color cCol ;
|
|
if ( ExeGetCalcColor( nId, cCol)) {
|
|
// restituisco il risultato
|
|
LuaSetParam( L, cCol) ;
|
|
}
|
|
else
|
|
LuaSetParam( L) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaSetName( lua_State* L)
|
|
{
|
|
// 2 parametri : Id, Name
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
string sName ;
|
|
LuaCheckParam( L, 2, sName)
|
|
LuaClearStack( L) ;
|
|
// assegno il nome
|
|
bool bOk = ExeSetName( nId, sName) ;
|
|
// restituisco il risultato
|
|
LuaSetParam( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaGetName( lua_State* L)
|
|
{
|
|
// 1 parametro : Id
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
LuaClearStack( L) ;
|
|
// recupero il nome
|
|
string sName ;
|
|
bool bOk = ExeGetName( nId, sName) ;
|
|
// restituisco il risultato
|
|
if ( bOk)
|
|
LuaSetParam( L, sName) ;
|
|
else
|
|
LuaSetParam( L) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaExistsName( lua_State* L)
|
|
{
|
|
// 1 parametro : Id
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
LuaClearStack( L) ;
|
|
// verifico esistenza nome
|
|
bool bOk = ExeExistsName( nId) ;
|
|
// restituisco il risultato
|
|
LuaSetParam( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaRemoveName( lua_State* L)
|
|
{
|
|
// 1 parametro : Id
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
LuaClearStack( L) ;
|
|
// verifico esistenza nome
|
|
bool bOk = ExeRemoveName( nId) ;
|
|
// restituisco il risultato
|
|
LuaSetParam( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaSetInfo( lua_State* L)
|
|
{
|
|
// 3 parametri : Id, Key, bVal|nVal|dVal|sVal|vtVal|ptVal|b3Val|frVal
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
string sKey ;
|
|
LuaCheckParam( L, 2, sKey)
|
|
bool bOk = false ;
|
|
switch ( lua_type( L, 3)) {
|
|
case LUA_TBOOLEAN :
|
|
{ bool bVal ;
|
|
LuaGetParam( L, 3, bVal) ;
|
|
LuaClearStack( L) ;
|
|
bOk = ExeSetInfo( nId, sKey, bVal) ;
|
|
} break ;
|
|
case LUA_TNUMBER :
|
|
{ double dVal ;
|
|
LuaGetParam( L, 3, dVal) ;
|
|
LuaClearStack( L) ;
|
|
bOk = ExeSetInfo( nId, sKey, dVal) ;
|
|
} break ;
|
|
case LUA_TSTRING :
|
|
{ string sVal ;
|
|
LuaGetParam( L, 3, sVal) ;
|
|
LuaClearStack( L) ;
|
|
bOk = ExeSetInfo( nId, sKey, sVal) ;
|
|
} break ;
|
|
case LUA_TTABLE :
|
|
{ Frame3d frVal ;
|
|
BBox3d b3Val ;
|
|
DBLVECTOR vdVal ; // va bene anche per Vector3d, Point3d, vnVal
|
|
STRVECTOR vsVal ;
|
|
if ( LuaGetParam( L, 3, frVal)) {
|
|
LuaClearStack( L) ;
|
|
bOk = ExeSetInfo( nId, sKey, frVal) ;
|
|
}
|
|
else if ( LuaGetParam( L, 3, b3Val)) {
|
|
LuaClearStack( L) ;
|
|
bOk = ExeSetInfo( nId, sKey, b3Val) ;
|
|
}
|
|
else if ( LuaGetParam( L, 3, vdVal)) {
|
|
LuaClearStack( L) ;
|
|
bOk = ExeSetInfo( nId, sKey, vdVal) ;
|
|
}
|
|
else if ( LuaGetParam( L, 3, vsVal)) {
|
|
LuaClearStack( L) ;
|
|
bOk = ExeSetInfo( nId, sKey, vsVal) ;
|
|
}
|
|
} break ;
|
|
}
|
|
// restituisco il risultato
|
|
LuaSetParam( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaGetInfo( lua_State* L)
|
|
{
|
|
// 2 o 3 parametri : Id, Key, sType
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
string sKey ;
|
|
LuaCheckParam( L, 2, sKey)
|
|
string sType = "s" ;
|
|
LuaGetParam( L, 3, sType) ;
|
|
LuaClearStack( L) ;
|
|
// recupero l'info
|
|
if ( sType == "b" || sType == "B") {
|
|
bool bVal ;
|
|
if ( ExeGetInfo( nId, sKey, bVal))
|
|
LuaSetParam( L, bVal) ;
|
|
else
|
|
LuaSetParam( L) ;
|
|
}
|
|
else if ( sType == "i" || sType == "I") {
|
|
int nVal ;
|
|
if ( ExeGetInfo( nId, sKey, nVal))
|
|
LuaSetParam( L, nVal) ;
|
|
else
|
|
LuaSetParam( L) ;
|
|
}
|
|
else if ( sType == "d" || sType == "D") {
|
|
double dVal ;
|
|
if ( ExeGetInfo( nId, sKey, dVal))
|
|
LuaSetParam( L, dVal) ;
|
|
else
|
|
LuaSetParam( L) ;
|
|
}
|
|
else if ( sType == "v" || sType == "V") {
|
|
Vector3d vtVal ;
|
|
if ( ExeGetInfo( nId, sKey, vtVal))
|
|
LuaSetParam( L, vtVal) ;
|
|
else
|
|
LuaSetParam( L) ;
|
|
}
|
|
else if ( sType == "p" || sType == "P") {
|
|
Point3d ptVal ;
|
|
if ( ExeGetInfo( nId, sKey, ptVal))
|
|
LuaSetParam( L, ptVal) ;
|
|
else
|
|
LuaSetParam( L) ;
|
|
}
|
|
else if ( sType == "x" || sType == "X") {
|
|
BBox3d b3Val ;
|
|
if ( ExeGetInfo( nId, sKey, b3Val))
|
|
LuaSetParam( L, b3Val) ;
|
|
else
|
|
LuaSetParam( L) ;
|
|
}
|
|
else if ( sType == "f" || sType == "F") {
|
|
Frame3d frVal ;
|
|
if ( ExeGetInfo( nId, sKey, frVal))
|
|
LuaSetParam( L, frVal) ;
|
|
else
|
|
LuaSetParam( L) ;
|
|
}
|
|
else if ( sType == "vi" || sType == "vI") {
|
|
INTVECTOR vnVal ;
|
|
if ( ExeGetInfo( nId, sKey, vnVal))
|
|
LuaSetParam( L, vnVal) ;
|
|
else
|
|
LuaSetParam( L) ;
|
|
}
|
|
else if ( sType == "vd" || sType == "vD") {
|
|
DBLVECTOR vdVal ;
|
|
if ( ExeGetInfo( nId, sKey, vdVal))
|
|
LuaSetParam( L, vdVal) ;
|
|
else
|
|
LuaSetParam( L) ;
|
|
}
|
|
else if ( sType == "vs" || sType == "vS") {
|
|
STRVECTOR vsVal ;
|
|
if ( ExeGetInfo( nId, sKey, vsVal))
|
|
LuaSetParam( L, vsVal) ;
|
|
else
|
|
LuaSetParam( L) ;
|
|
}
|
|
else { // "s" "S"
|
|
string sInfo ;
|
|
if ( ExeGetInfo( nId, sKey, sInfo))
|
|
LuaSetParam( L, sInfo) ;
|
|
else
|
|
LuaSetParam( L) ;
|
|
}
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaExistsInfo( lua_State* L)
|
|
{
|
|
// 2 parametri : Id, Key
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
string sKey ;
|
|
LuaCheckParam( L, 2, sKey)
|
|
LuaClearStack( L) ;
|
|
// verifico esistenza info
|
|
bool bOk = ExeExistsInfo( nId, sKey) ;
|
|
// restituisco il risultato
|
|
LuaSetParam( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaRemoveInfo( lua_State* L)
|
|
{
|
|
// 2 parametri : Id, Key
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
string sKey ;
|
|
LuaCheckParam( L, 2, sKey)
|
|
LuaClearStack( L) ;
|
|
// rimuovo info
|
|
bool bOk = ExeRemoveInfo( nId, sKey) ;
|
|
// restituisco il risultato
|
|
LuaSetParam( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaGetAllInfo( lua_State* L)
|
|
{
|
|
// 1 parametro : Id
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
LuaClearStack( L) ;
|
|
// recupero tutte le info
|
|
STRVECTOR vsInfo ;
|
|
bool bOk = ExeGetAllInfo( nId, vsInfo) ;
|
|
// restituisco il risultato
|
|
if ( bOk)
|
|
LuaSetParam( L, vsInfo) ;
|
|
else
|
|
LuaSetParam( L) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaSetTextureName( lua_State* L)
|
|
{
|
|
// 2 parametri : Id, Nome
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
string sTxrName ;
|
|
LuaCheckParam( L, 2, sTxrName)
|
|
LuaClearStack( L) ;
|
|
// assegno il nome della texture
|
|
bool bOk = ExeSetTextureName( nId, sTxrName) ;
|
|
// restituisco il risultato
|
|
LuaSetParam( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaSetTextureFrame( lua_State* L)
|
|
{
|
|
// 2 o 3 parametri : Id, TxrRef [, nRefType]
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
Frame3d frTxrRef ;
|
|
LuaCheckParam( L, 2, frTxrRef)
|
|
int nRefType = RTY_DEFAULT ;
|
|
LuaGetParam( L, 3, nRefType) ;
|
|
LuaClearStack( L) ;
|
|
// assegno il riferimento della texture
|
|
bool bOk = ExeSetTextureFrame( nId, frTxrRef, nRefType) ;
|
|
// restituisco il risultato
|
|
LuaSetParam( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaRemoveTextureData( lua_State* L)
|
|
{
|
|
// 1 parametro : Id
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
LuaClearStack( L) ;
|
|
// rimuovo i dati della texture
|
|
bool bOk = ExeRemoveTextureData( nId) ;
|
|
// restituisco il risultato
|
|
LuaSetParam( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaGetTextureName( lua_State* L)
|
|
{
|
|
// 1 parametro : Id
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
LuaClearStack( L) ;
|
|
// recupero il nome della texture
|
|
string sTxrName ;
|
|
bool bOk = ExeGetTextureName( nId, sTxrName) ;
|
|
// restituisco il risultato
|
|
if ( bOk)
|
|
LuaSetParam( L, sTxrName) ;
|
|
else
|
|
LuaSetParam( L) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaGetTextureFrame( lua_State* L)
|
|
{
|
|
// 1 o 2 parametri : Id [, nRefId]
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
int nRefId = nId ;
|
|
LuaGetParam( L, 2, nRefId) ;
|
|
LuaClearStack( L) ;
|
|
// recupero il riferimento della texture
|
|
Frame3d frTxrRef ;
|
|
bool bOk = ExeGetTextureFrame( nId, nRefId, frTxrRef) ;
|
|
// restituisco il risultato
|
|
if ( bOk)
|
|
LuaSetParam( L, frTxrRef) ;
|
|
else
|
|
LuaSetParam( L) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaSetStipple( lua_State* L)
|
|
{
|
|
// 3 parametri : Id, nFactor, nPattern
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
int nFactor ;
|
|
LuaCheckParam( L, 2, nFactor)
|
|
int nPattern ;
|
|
LuaCheckParam( L, 3, nPattern)
|
|
LuaClearStack( L) ;
|
|
// setto stipple
|
|
bool bOk = ExeSetStipple( nId, nFactor, nPattern) ;
|
|
// restituisco il risultato
|
|
LuaSetParam( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
bool
|
|
LuaInstallGdbObjAttribs( LuaMgr& luaMgr)
|
|
{
|
|
bool bOk = ( &luaMgr != nullptr) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtCopyAttributes", LuaCopyAttributes) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSetLevel", LuaSetLevel) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtRevertLevel", LuaRevertLevel) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetLevel", LuaGetLevel) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcLevel", LuaGetCalcLevel) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSetMode", LuaSetMode) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtRevertMode", LuaRevertMode) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetMode", LuaGetMode) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcMode", LuaGetCalcMode) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSetStatus", LuaSetStatus) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtRevertStatus", LuaRevertStatus) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetStatus", LuaGetStatus) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcStatus", LuaGetCalcStatus) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSetMark", LuaSetMark) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtResetMark", LuaResetMark) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetMark", LuaGetMark) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcMark", LuaGetCalcMark) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtStdColor", LuaStdColor) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSetColor", LuaSetColor) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSetAlpha", LuaSetAlpha) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtResetColor", LuaResetColor) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetColor", LuaGetColor) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcColor", LuaGetCalcColor) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSetName", LuaSetName) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetName", LuaGetName) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtExistsName", LuaExistsName) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveName", LuaRemoveName) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSetInfo", LuaSetInfo) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetInfo", LuaGetInfo) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtExistsInfo", LuaExistsInfo) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveInfo", LuaRemoveInfo) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAllInfo", LuaGetAllInfo) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSetTextureName", LuaSetTextureName) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSetTextureFrame", LuaSetTextureFrame) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveTextureData", LuaRemoveTextureData) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetTextureName", LuaGetTextureName) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetTextureFrame", LuaGetTextureFrame) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSetStipple", LuaSetStipple) ;
|
|
return bOk ;
|
|
}
|