| 3422 | } |
| 3423 | |
| 3424 | PropertyResult GetProperty(HInstance instance, dmhash_t component_id, dmhash_t property_id, PropertyOptions options, PropertyDesc& out_value) |
| 3425 | { |
| 3426 | if (instance == 0) |
| 3427 | return PROPERTY_RESULT_INVALID_INSTANCE; |
| 3428 | |
| 3429 | out_value.m_ValueType = dmGameObject::PROP_VALUE_ARRAY; |
| 3430 | out_value.m_ArrayLength = 0; |
| 3431 | |
| 3432 | if (component_id == 0) |
| 3433 | { |
| 3434 | out_value.m_ValuePtr = 0x0; |
| 3435 | |
| 3436 | // Scale used to be a uniform scalar, but is now a non-uniform 3-component scale |
| 3437 | if (property_id == PROP_SCALE) |
| 3438 | { |
| 3439 | float* scale = instance->m_Transform.GetScalePtr(); |
| 3440 | out_value.m_ValuePtr = scale; |
| 3441 | out_value.m_ElementIds[0] = PROP_SCALE_X; |
| 3442 | out_value.m_ElementIds[1] = PROP_SCALE_Y; |
| 3443 | out_value.m_ElementIds[2] = PROP_SCALE_Z; |
| 3444 | out_value.m_Variant = PropertyVar(instance->m_Transform.GetScale()); |
| 3445 | } |
| 3446 | else if (property_id == PROP_SCALE_XY) |
| 3447 | { |
| 3448 | float* scale = instance->m_Transform.GetScalePtr(); |
| 3449 | out_value.m_ValuePtr = scale; |
| 3450 | out_value.m_ElementIds[0] = PROP_SCALE_X; |
| 3451 | out_value.m_ElementIds[1] = PROP_SCALE_Y; |
| 3452 | out_value.m_ElementIds[2] = 0; |
| 3453 | Vector3 vec = instance->m_Transform.GetScale(); |
| 3454 | vec.setZ(1.0f); |
| 3455 | out_value.m_Variant = PropertyVar(vec); |
| 3456 | } |
| 3457 | else if (property_id == PROP_SCALE_X) |
| 3458 | { |
| 3459 | float* scale = instance->m_Transform.GetScalePtr(); |
| 3460 | out_value.m_ValuePtr = scale; |
| 3461 | out_value.m_Variant = PropertyVar(*out_value.m_ValuePtr); |
| 3462 | } |
| 3463 | else if (property_id == PROP_SCALE_Y) |
| 3464 | { |
| 3465 | float* scale = instance->m_Transform.GetScalePtr(); |
| 3466 | out_value.m_ValuePtr = scale + 1; |
| 3467 | out_value.m_Variant = PropertyVar(*out_value.m_ValuePtr); |
| 3468 | } |
| 3469 | else if (property_id == PROP_SCALE_Z) |
| 3470 | { |
| 3471 | float* scale = instance->m_Transform.GetScalePtr(); |
| 3472 | out_value.m_ValuePtr = scale + 2; |
| 3473 | out_value.m_Variant = PropertyVar(*out_value.m_ValuePtr); |
| 3474 | } |
| 3475 | else if (property_id == PROP_POSITION) |
| 3476 | { |
| 3477 | float* position = instance->m_Transform.GetPositionPtr(); |
| 3478 | out_value.m_ValuePtr = position; |
| 3479 | out_value.m_ElementIds[0] = PROP_POSITION_X; |
| 3480 | out_value.m_ElementIds[1] = PROP_POSITION_Y; |
| 3481 | out_value.m_ElementIds[2] = PROP_POSITION_Z; |
no test coverage detected