Skip to content

Commit

Permalink
GetSize now works with variant counts
Browse files Browse the repository at this point in the history
  • Loading branch information
bigfug committed Jan 31, 2018
1 parent c8a466b commit 707a130
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 44 deletions.
110 changes: 67 additions & 43 deletions plugins/Core/getsizenode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <fugio/core/uuid.h>
#include <fugio/core/size_interface.h>
#include <fugio/pin_variant_iterator.h>

GetSizeNode::GetSizeNode( QSharedPointer<fugio::NodeInterface> pNode )
: NodeControlBase( pNode )
Expand Down Expand Up @@ -37,69 +38,92 @@ void GetSizeNode::inputsUpdated( qint64 pTimeStamp )

fugio::SizeInterface *SzeInt = input<fugio::SizeInterface *>( PinI );

if( !SzeInt )
if( SzeInt )
{
continue;
}
QVariant Size;

QVariant Size;
switch( SzeInt->sizeDimensions() )
{
case 1:
Size = SzeInt->sizeWidth();

switch( SzeInt->sizeDimensions() )
{
case 1:
Size = SzeInt->sizeWidth();
if( PinO->controlUuid() != PID_FLOAT )
{
QSharedPointer<fugio::PinControlInterface> PCI = mNode->context()->createPinControl( PID_FLOAT, PinO );

if( PinO->controlUuid() != PID_FLOAT )
{
QSharedPointer<fugio::PinControlInterface> PCI = mNode->context()->createPinControl( PID_FLOAT, PinO );
if( PCI )
{
PinO->setControl( PCI );

VarO = qobject_cast<fugio::VariantInterface *>( PCI->qobject() );
}
}
break;

case 2:
Size = SzeInt->toSizeF();

if( PCI )
if( PinO->controlUuid() != PID_SIZE )
{
PinO->setControl( PCI );
QSharedPointer<fugio::PinControlInterface> PCI = mNode->context()->createPinControl( PID_SIZE, PinO );

VarO = qobject_cast<fugio::VariantInterface *>( PCI->qobject() );
}
}
break;
if( PCI )
{
PinO->setControl( PCI );

case 2:
Size = SzeInt->toSizeF();
VarO = qobject_cast<fugio::VariantInterface *>( PCI->qobject() );
}
}
break;

if( PinO->controlUuid() != PID_SIZE )
{
QSharedPointer<fugio::PinControlInterface> PCI = mNode->context()->createPinControl( PID_SIZE, PinO );
case 3:
Size = SzeInt->toVector3D();

if( PCI )
if( PinO->controlUuid() != PID_SIZE_3D )
{
PinO->setControl( PCI );
QSharedPointer<fugio::PinControlInterface> PCI = mNode->context()->createPinControl( PID_SIZE_3D, PinO );

VarO = qobject_cast<fugio::VariantInterface *>( PCI->qobject() );
if( PCI )
{
PinO->setControl( PCI );

VarO = qobject_cast<fugio::VariantInterface *>( PCI->qobject() );
}
}
}
break;
break;
}

case 3:
Size = SzeInt->toVector3D();
if( VarO->variant() != Size )
{
VarO->setVariant( Size );

if( PinO->controlUuid() != PID_SIZE_3D )
{
QSharedPointer<fugio::PinControlInterface> PCI = mNode->context()->createPinControl( PID_SIZE_3D, PinO );
pinUpdated( PinO );
}
}
else
{
if( PinO->controlUuid() != PID_INTEGER )
{
QSharedPointer<fugio::PinControlInterface> PCI = mNode->context()->createPinControl( PID_INTEGER, PinO );

if( PCI )
{
PinO->setControl( PCI );
if( PCI )
{
PinO->setControl( PCI );

VarO = qobject_cast<fugio::VariantInterface *>( PCI->qobject() );
}
VarO = qobject_cast<fugio::VariantInterface *>( PCI->qobject() );
}
break;
}
}

if( VarO->variant() != Size )
{
VarO->setVariant( Size );
fugio::PinVariantIterator PinItr( PinI );

VarO->setVariantCount( 1 );

if( VarO->variant().toInt() != PinItr.size() )
{
VarO->setVariant( PinItr.size() );

pinUpdated( PinO );
pinUpdated( PinO );
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/Core/getsizenode.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class GetSizeNode : public fugio::NodeControlBase, fugio::PairedPinsHelperInterf

// PairedPinsHelperInterface interface
public:
virtual QUuid pairedPinControlUuid(QSharedPointer<fugio::PinInterface> pPin) const Q_DECL_OVERRIDE;
virtual QUuid pairedPinControlUuid( QSharedPointer<fugio::PinInterface> pPin ) const Q_DECL_OVERRIDE;
};

#endif // GETSIZENODE_H

0 comments on commit 707a130

Please sign in to comment.