Example #1
0
void tbl_nativeDoBinary(M doBinary, T* pTable, JNIEnv* env, jlong columnIndex, jlong rowIndex, jobject byteBuffer)
{
    BinaryData bin;
    if (GetBinaryData(env, byteBuffer, bin))
        (pTable->*doBinary)( S(columnIndex), S(rowIndex), bin);
}
Example #2
0
void tbl_nativeDoMixed(M doMixed, T* pTable, JNIEnv* env, jlong columnIndex, jlong rowIndex, jobject jMixedValue)
{
    DataType valueType = GetMixedObjectType(env, jMixedValue);
    switch(valueType) {
    case type_Int:
        {
            jlong longValue = GetMixedIntValue(env, jMixedValue);
            (pTable->*doMixed)( S(columnIndex), S(rowIndex), Mixed(static_cast<int64_t>(longValue)));
            return;
        }
    case type_Float:
        {
            jfloat floatValue = GetMixedFloatValue(env, jMixedValue);
            (pTable->*doMixed)( S(columnIndex), S(rowIndex), Mixed(floatValue));
            return;
        }
    case type_Double:
        {
            jdouble doubleValue = GetMixedDoubleValue(env, jMixedValue);
            (pTable->*doMixed)( S(columnIndex), S(rowIndex), Mixed(doubleValue));
            return;
        }
    case type_Bool:
        {
            jboolean boolValue = GetMixedBooleanValue(env, jMixedValue);
            (pTable->*doMixed)( S(columnIndex), S(rowIndex), Mixed(boolValue != 0 ? true : false));
            return;
        }
    case type_String:
        {
            jstring stringValue = GetMixedStringValue(env, jMixedValue);
            JStringAccessor string(env, stringValue); // throws
            (pTable->*doMixed)( S(columnIndex), S(rowIndex), StringData(string));
            return;
        }
    case type_DateTime:
        {
            jlong dateTimeValue = GetMixedDateTimeValue(env, jMixedValue);
            DateTime date(dateTimeValue);
            (pTable->*doMixed)( S(columnIndex), S(rowIndex), Mixed(date));
            return;
        }
    case type_Binary:
        {
            jint mixedBinaryType = GetMixedBinaryType(env, jMixedValue);
            if (mixedBinaryType == 0) {
                jbyteArray dataArray = GetMixedByteArrayValue(env, jMixedValue);
                if (!dataArray)
                    break;
                char* data = reinterpret_cast<char*>(env->GetByteArrayElements(dataArray, NULL));
                if (!data)
                    break;
                size_t size = S(env->GetArrayLength(dataArray));
                (pTable->*doMixed)( S(columnIndex), S(rowIndex), BinaryData(data, size));
                env->ReleaseByteArrayElements(dataArray, reinterpret_cast<jbyte*>(data), 0);
                return;
            }
            else if (mixedBinaryType == 1) {
                jobject jByteBuffer = GetMixedByteBufferValue(env, jMixedValue);
                if (!jByteBuffer)
                    break;
                BinaryData binaryData;
                if (GetBinaryData(env, jByteBuffer, binaryData))
                    (pTable->*doMixed)( S(columnIndex), S(rowIndex), binaryData);
                return;
            }
            break; // failed
        }
    case type_Table:
        {
            (pTable->*doMixed)( S(columnIndex), S(rowIndex), Mixed::subtable_tag());
            return;
        }
    case type_Mixed:
        break;
    case type_Link:
        break;
    case type_LinkList:
        break;
    }
    TR_ERR("ERROR: nativeSetMixed() failed.")
    ThrowException(env, IllegalArgument, "nativeSetMixed()");
}
void UPhysicsSerializer::SerializePhysics(const TArray<FBodyInstance*>& Bodies, const TArray<UBodySetup*>& BodySetups, const TArray<UPhysicalMaterial*>& PhysicalMaterials)
{
#if WITH_EDITOR
	GetBinaryData(FPlatformProperties::GetPhysicsFormat(), Bodies, BodySetups, PhysicalMaterials);	//build the binary data
#endif
}