@@ -178,7 +178,45 @@ static int ue_py_ftransform_init(ue_PyFTransform *self, PyObject *args, PyObject
178178 }
179179 else
180180 {
181- PyErr_SetString (PyExc_Exception, " argument is not a FVector" );
181+ PyObject *py_iter = PyObject_GetIter (py_translation);
182+ if (py_iter)
183+ {
184+ FMatrix matrix;
185+ for (int row = 0 ; row < 4 ; row++)
186+ {
187+ for (int column = 0 ; column < 4 ; column++)
188+ {
189+ PyObject *py_item = PyIter_Next (py_iter);
190+ if (!py_item)
191+ {
192+ PyErr_SetString (PyExc_Exception, " matrix is not 4x4" );
193+ Py_DECREF (py_iter);
194+ return -1 ;
195+ }
196+
197+ if (!PyNumber_Check (py_item))
198+ {
199+ PyErr_SetString (PyExc_Exception, " matrix can contains only float" );
200+ Py_DECREF (py_iter);
201+ return -1 ;
202+ }
203+
204+ PyObject *py_num = PyNumber_Float (py_item);
205+ if (!py_num)
206+ {
207+ PyErr_SetString (PyExc_Exception, " matrix can contains only float" );
208+ Py_DECREF (py_iter);
209+ return -1 ;
210+ }
211+ matrix.M [row][column] = PyFloat_AsDouble (py_num);
212+ Py_DECREF (py_num);
213+ }
214+ }
215+ self->transform .SetFromMatrix (matrix);
216+ Py_DECREF (py_iter);
217+ return 0 ;
218+ }
219+ PyErr_SetString (PyExc_Exception, " argument is not a FVector or a 4x4 float matrix" );
182220 return -1 ;
183221 }
184222 }
@@ -230,13 +268,17 @@ static PyObject *ue_py_ftransform_mul(ue_PyFTransform *self, PyObject *value)
230268 {
231269 t *= py_quat->quat ;
232270 }
271+ else if (ue_PyFRotator *py_rot = py_ue_is_frotator (value))
272+ {
273+ t *= py_rot->rot .Quaternion ();
274+ }
233275 else if (ue_PyFTransform *py_transform = py_ue_is_ftransform (value))
234276 {
235277 t *= py_transform->transform ;
236278 }
237279 else
238280 {
239- return PyErr_Format (PyExc_TypeError, " FTransform can be multiplied only for an FQuat or an FTransform" );
281+ return PyErr_Format (PyExc_TypeError, " FTransform can be multiplied only for an FQuat, an FRotator or an FTransform" );
240282 }
241283 return py_ue_new_ftransform (t);
242284}
0 commit comments