Skip to content

Commit

Permalink
Merge pull request #6 from amorilia/release/1.1.0
Browse files Browse the repository at this point in the history
Preparing the 1.1.0 release.
  • Loading branch information
mharj committed Sep 17, 2012
2 parents dd5949c + 141fde6 commit 29ab55b
Show file tree
Hide file tree
Showing 16 changed files with 181 additions and 240 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# generated ones
config.h
Makefile
moc_*.cpp
qrc_*.cpp
Expand Down
7 changes: 6 additions & 1 deletion CHANGELOG.TXT
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
== CHANGELOG ==

This is version 1.1.0-RC8 of NifSkope.
This is version 1.1.0 of NifSkope.

changes since 1.1.0-RC8:
* Collada export fixes for Skyrim and Blender (contributed by mharj).
* Various small bug fixes in the xml.
* Fix uv editor for Skyrim nifs.

changes since 1.1.0-RC7:
* Collada export (contributed by mharj).
Expand Down
15 changes: 14 additions & 1 deletion NifSkope.pro
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ TARGET = NifSkope

QT += xml opengl network

CONFIG += qt release thread warn_on
CONFIG += qt debug_and_release thread warn_on

CONFIG += fsengine

Expand All @@ -26,6 +26,19 @@ macx{
# On Linux you may need CONFIG += debug_and_release debug_and_release_target
DESTDIR = .

# NIFSKOPE_VERSION macro
DEFINES += NIFSKOPE_VERSION=\\\"$$cat(VERSION)\\\"

# build NIFSKOPE_REVISION macro
unix {
system(git --version > /dev/null 2>&1):DEFINES += NIFSKOPE_REVISION=\\\"$$system(git log -1 --pretty=format:%h)\\\"
else:DEFINES += NIFSKOPE_REVISION=\\\"unknown\\\"
}
win32 {
system(git --version > NUL 2>&1):DEFINES += NIFSKOPE_REVISION=\\\"$$system(git log -1 --pretty=format:%h)\\\"
else:DEFINES += NIFSKOPE_REVISION=\\\"unknown\\\"
}

HEADERS += \
basemodel.h \
config.h \
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1.0c8
1.1.0
211 changes: 25 additions & 186 deletions basemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,112 +78,9 @@ bool BaseModel::isArray( const QModelIndex & index ) const

int BaseModel::getArraySize( NifItem * array ) const
{
return evaluateString( array, array->arr1() );
}

int BaseModel::evaluateString( NifItem * array, const QString & text ) const
{
NifItem * parent = array->parent();
if ( ! parent || parent == root )
return -1;

if ( text.isEmpty() )
return 0;

bool ok;
int d1 = text.toInt( &ok );
if ( ! ok )
{
QString left, right;

// TODO: work out how to deal with brackets...
static const char * const exp[] = { " | ", " & ", " / ", " + ", " - ", " * " };
static const int num_exp = 6;

int c;
for ( c = 0; c < num_exp; c++ )
{
int p = text.indexOf( exp[c] );
if ( p > 0 )
{
left = text.left( p ).trimmed();
right = text.right( text.length() - p - strlen( exp[c] ) ).trimmed();
break;
}
}

if ( c >= num_exp )
{
left = text.trimmed();
c = 0;
}

int r = 0; // d1 is left

bool ok;

if ( ! left.isEmpty() )
{
d1 = left.toInt( &ok );
if ( ! ok )
{
NifItem * dim1 = parent;

while ( left == "ARG" )
{
if ( ! dim1->parent() ) return 0;
left = dim1->arg();
dim1 = dim1->parent();
}

dim1 = getItem( dim1, left );
if ( ! dim1 )
{
d1 = 0;
}
else if ( dim1->childCount() == 0 )
{
d1 = dim1->value().toCount();
}
else
{
NifItem * item = dim1->child( array->row() );
if ( item )
d1 = item->value().toCount();
else {
d1 = 0;
};
}
}
}

if ( ! right.isEmpty() )
{
r = right.toInt( &ok );
if ( ! ok )
{
msg( Message() << tr("failed to get array size for array ") << array->name() );
return 0;
}
}

switch ( c )
{
case 0: d1 |= r; break;
case 1: d1 &= r; break;
case 2: d1 /= r; break;
case 3: d1 += r; break;
case 4: d1 -= r; break;
case 5: d1 *= r; break;
}
}

if ( d1 < 0 )
{
msg( Message() << tr("invalid array size for array") << array->name() );
d1 = -1;
}
return d1;
// shortcut for speed
if ( array->arr1().isEmpty() ) return 0;
return evaluateInt( array, array->arr1expr() );
}

bool BaseModel::updateArray( const QModelIndex & array )
Expand Down Expand Up @@ -693,6 +590,19 @@ class BaseModelEval
return QVariant( sibling->value().toCount() );
else if ( sibling->value().isFileVersion() )
return QVariant( sibling->value().toFileVersion() );
// this is tricky to understand
// we check whether the reference is an array
// if so, we get the current item's row number (i->row())
// and get the sibling's child at that row number
// this is used for instance to describe array sizes of strips
else if ( sibling->childCount() > 0 ) {
const NifItem * i2 = sibling->child( i->row() );
if ( i2 && i2->value().isCount() )
return QVariant(i2->value().toCount());
}
else {
qDebug() << ("can't convert " + left + " to a count");
}
}
// resolve reference to block type
// is the condition string a type?
Expand All @@ -710,6 +620,15 @@ class BaseModelEval
}
};

int BaseModel::evaluateInt( NifItem * item, const Expression & expr ) const
{
if ( ! item || item == root )
return -1;

BaseModelEval functor(this, item);
return expr.evaluateUInt(functor);
}

bool BaseModel::evalCondition( NifItem * item, bool chkParents ) const
{
if ( ! evalVersion( item, chkParents ) )
Expand All @@ -730,86 +649,6 @@ bool BaseModel::evalCondition( NifItem * item, bool chkParents ) const
return item->condexpr().evaluateBool(functor);
}

bool BaseModel::evalConditionHelper( NifItem * item, const QString & cond ) const
{
QString left, right;

static const char * const exp[] = { "!=", "==", ">=", "<=", ">", "<", "&", "+", "-" };
static const int num_exp = 9;

int c;
for ( c = 0; c < num_exp; c++ )
{
int p = cond.indexOf( exp[c] );
if ( p > 0 )
{
left = cond.left( p ).trimmed();
right = cond.right( cond.length() - p - strlen( exp[c] ) ).trimmed();
break;
}
}

if ( c >= num_exp )
{
left = cond.trimmed();
c = 0;
}

int l = 0;
int r = 0;

bool ok;

if ( ! left.isEmpty() )
{
l = left.toInt( &ok );
if ( ! ok )
{
NifItem * i = item;

while ( left == "ARG" )
{
if ( ! i->parent() ) return false;
i = i->parent();
left = i->arg();
}

i = getItem( i->parent(), left );
if ( i )
l = i->value().toCount();
else
l = 0;
}
}

if ( ! right.isEmpty() )
{
r = right.toInt( &ok );
if ( ! ok )
{
NifItem * i = getItem( item->parent(), right );
if ( i )
r = i->value().toCount();
else
r = 0;
}
}

switch ( c )
{
case 0: return l != r;
case 1: return l == r;
case 2: return l >= r;
case 3: return l <= r;
case 4: return l > r;
case 5: return l < r;
case 6: return l & r;
case 7: return l + r;
case 8: return l - r;
default: return false;
}
}

bool BaseModel::evalVersion( const QModelIndex & index, bool chkParents ) const
{
NifItem * item = static_cast<NifItem*>( index.internalPointer() );
Expand Down
4 changes: 1 addition & 3 deletions basemodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ Q_OBJECT
//! Get the size of an array
int getArraySize( NifItem * array ) const;
//! Evaluate a string for an array
int evaluateString( NifItem * array, const QString & text ) const;
int evaluateInt( NifItem * item, const Expression & expr) const;

//! Get an item
virtual NifItem * getItem( NifItem * parent, const QString & name ) const;
Expand All @@ -268,8 +268,6 @@ Q_OBJECT
virtual bool evalVersion( NifItem * item, bool chkParents = false ) const = 0;
//! Evaluate conditions
bool evalCondition( NifItem * item, bool chkParents = false ) const;
//! Evaluate conditions
bool evalConditionHelper( NifItem * item, const QString & cond ) const;

//! Convert a version number to a string
virtual QString ver2str( quint32 ) const = 0;
Expand Down
8 changes: 0 additions & 8 deletions config.h.in → config.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// NOTE: Run makeconfig.sh on this file

/***** BEGIN LICENSE BLOCK *****
BSD License
Expand Down Expand Up @@ -70,12 +68,6 @@ const QStringList NIFSKOPE_OLDERVERSIONS = (QStringList()
<< "NifSkope-1.0.5"
<< "NifSkope");

//! A string describing the version of nifskope
#define NIFSKOPE_VERSION "@VERSION@"

//! The repository revision number; generated with TortoiseSVN's SubWCRev.exe
#define NIFSKOPE_REVISION "@WCREV@"

//! Create or use a QSettings variable for nifskope
#define NIFSKOPE_QSETTINGS(config) QSettings config( "NifTools", "NifSkope-"NIFSKOPE_VERSION )

Expand Down
2 changes: 1 addition & 1 deletion docsys
Submodule docsys updated from 28339a to 2ba01e
4 changes: 3 additions & 1 deletion gl/glmesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,9 @@ void Mesh::transform()
double_sided_es = false;
if ( nif->checkVersion( 0x14020007, 0 ) && nif->inherits( iBlock, "NiTriBasedGeom") )
{
QVector<qint32> props = nif->getLinkArray( iBlock, "Properties" );
QVector<qint32> props =
nif->getLinkArray( iBlock, "Properties" )
+ nif->getLinkArray( iBlock, "BS Properties" );
for (int i = 0; i < props.count(); i++)
{
QModelIndex iProp = nif->getBlock( props[i], PROP_LightingShaderProperty );
Expand Down
Loading

0 comments on commit 29ab55b

Please sign in to comment.