Files
blender/source/gameengine/Expressions/intern/EmptyValue.cpp
Jorge Bernal 6ffc988ae3 BGE Clean-up: New EXP prefix for the BGE Expression module
The expression module now uses an EXP prefix and it follows a
distribution similar to blender.

Additionally the hash function in EXP_HashedPtr.h was simplified and the
files EXP_C-Api.h &.EXP_C-Api.cpp were deleted because were unused.

Reviewers: campbellbarton, moguri, sybren, hg1

Projects: #game_engine

Differential Revision: https://developer.blender.org/D1221
2015-07-12 16:58:12 +02:00

134 lines
2.4 KiB
C++

/** \file gameengine/Expressions/EmptyValue.cpp
* \ingroup expressions
*/
// EmptyValue.cpp: implementation of the CEmptyValue class.
/*
* Copyright (c) 1996-2000 Erwin Coumans <coockie@acm.org>
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Erwin Coumans makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
*/
#include "EXP_EmptyValue.h"
#include "EXP_IntValue.h"
#include "EXP_FloatValue.h"
#include "EXP_StringValue.h"
#include "EXP_ErrorValue.h"
#include "EXP_ListValue.h"
#include "EXP_VoidValue.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CEmptyValue::CEmptyValue()
/*
* pre:
* effect: constructs a new CEmptyValue
*/
{
SetModified(false);
}
CEmptyValue::~CEmptyValue()
/*
* pre:
* effect: deletes the object
*/
{
}
CValue *CEmptyValue::Calc(VALUE_OPERATOR op, CValue *val)
/*
* pre:
* ret: a new object containing the result of applying operator op to this
* object and val
*/
{
return val->CalcFinal(VALUE_EMPTY_TYPE, op, this);
}
CValue * CEmptyValue::CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val)
/*
* pre: the type of val is dtype
* ret: a new object containing the result of applying operator op to val and
* this object
*/
{
return val->AddRef();
}
double CEmptyValue::GetNumber()
{
return 0;
}
int CEmptyValue::GetValueType()
{
return VALUE_EMPTY_TYPE;
}
CListValue* CEmptyValue::GetPolySoup()
{
CListValue* soup = new CListValue();
//don't add any poly, while it's an empty value
return soup;
}
bool CEmptyValue::IsInside(CValue* testpoint,bool bBorderInclude)
{
// empty space is solid, so always inside
return true;
}
double* CEmptyValue::GetVector3(bool bGetTransformedVec)
{
assertd(false); // don't get vector from me
return ZeroVector();
}
static STR_String emptyString = STR_String("");
const STR_String & CEmptyValue::GetText()
{
return emptyString;
}
CValue* CEmptyValue::GetReplica()
{
CEmptyValue* replica = new CEmptyValue(*this);
replica->ProcessReplica();
return replica;
}