//----------------------------------------------------------------------------
void InterpCurveRotateController::SetControlledable(Controlledable* object)
{
	if (object)
	{
		if (IsAttachUpdateInit())
		{
			Movable* movable = StaticCast<Movable>(mObject);
			if (movable)
			{
				Matrix3f mat = movable->LocalTransform.GetRotate();
				mat.ExtractEulerXYZ(mInitValue[0], mInitValue[1], mInitValue[2]);
			}
		}
	}
	else
	{
		if (IsDetachResetInit())
		{
			Movable* movable = StaticCast<Movable>(mObject);
			if (movable)
			{
				movable->LocalTransform.SetRotate(Matrix3f().MakeEulerXYZ(
					mInitValue[0], mInitValue[1], mInitValue[2]));
			}
		}
	}

	InterpCurveFloat3Controller::SetControlledable(object);
}
MovableTransProperty::MovableTransProperty (PropertyPage *parent, 
	const std::string &name, const std::string &tag,
	Transform *trans, Object *obj)
	:
Property(parent, name, tag, Property::PT_TRANSFORM, 0),
	mIsRSMatrix(0),
	mPropertyTranslate(0),
	mPropertyRotation(0),
	mPropertyScale(0),
	mPropertyIsUniformScale(0),
	mTrans(trans),
	mObject(obj)
{
	APoint position;
	APoint rotation;
	APoint scale(1.0f, 1.0f, 1.0f);

	bool isRSMatrix = mTrans->IsRSMatrix();
	if (isRSMatrix)
	{
		position = mTrans->GetTranslate();
		Matrix3f mat = mTrans->GetRotate();
		mat.ExtractEulerXYZ(rotation.X(), rotation.Y(), rotation.Z());
		scale = mTrans->GetScale();
		bool isUniformScale = mTrans->IsUniformScale();

		mProperty = parent->mPage->Append(new wxStringProperty(
			name, tag, wxT("<composed>")) );

		mPropertyTranslate = parent->mPage->AppendIn(mProperty, 
			new wxAPoint3Property("Translate", tag+"Translate",
			position));
		mPropertyRotation = parent->mPage->AppendIn(mProperty, 
			new wxAPoint3Property("Rotate", tag+"Rotate", rotation));
		mPropertyScale = parent->mPage->AppendIn(mProperty, 
			new wxAPoint3Property("Scale", tag+"Scale", scale));

		mPropertyIsUniformScale = parent->mPage->AppendIn(mProperty, 
			new wxBoolProperty("IsUniformScale", tag+"IsUniformScale", isUniformScale));
		mPropertyIsUniformScale->Enable(false);
	}
	else
	{
		mProperty = parent->mPage->Append(new wxStringProperty(
			name, tag, wxT("<composed>")) );

		mIsRSMatrix = parent->mPage->AppendIn(mProperty, 
			new wxBoolProperty("IsRSMatrix", tag+"IsRSMatrix", false));
		mIsRSMatrix->Enable(false);
	}
}
示例#3
0
//----------------------------------------------------------------------------
void EditMap::CreateCurveRotateCtrl (PX2::Movable *mov)
{
	if (!mov)
		return;

	Float3 initRotate;
	Matrix3f matRotate = mov->LocalTransform.GetRotate();
	matRotate.ExtractEulerXYZ(initRotate[0], initRotate[1], initRotate[2]);
	InterpCurveRotateController *ictCtrl = new0 InterpCurveRotateController(
		initRotate);
	ictCtrl->SetName("InterpCurveRotateController");
	mov->AttachController(ictCtrl);

	Event *ent = 0;
	ent = EditorEventSpace::CreateEventX(EditorEventSpace::AttachControl);
	ent->SetData<Object*>(ictCtrl);
	EventWorld::GetSingleton().BroadcastingLocalEvent(ent);
}
示例#4
0
//----------------------------------------------------------------------------
void Transform::GetRotate(float &x, float &y, float &z)
{
	Matrix3f mat = GetRotate();
	mat.ExtractEulerXYZ(x, y, z);
}