UE5. How to set animaton easing (in\out) in sequencer with Python. Picture inside - unreal-engine5

I can set easing manually.
I have found parameter “easing” in unreal.MovieSceneSection
unreal.MovieSceneSection
(easing (MovieSceneEasingSettings): [Read-Write] Easing)
i followed to MovieSceneEasingSettings
Bases: [unreal.StructBase]
Movie Scene Easing Settings
C++ Source:
Module: MovieScene
File: MovieSceneSection.h
When i try to see current parameters of easing,
unreal.log(My_animsection.get_editor_property("easing"))
i receive empty struct
LogPython: <Struct 'MovieSceneEasingSettings' (0x0000080193DA5B60) {}>
When i try to set variables (present in MovieSceneSection.h)
My_animsection.get_editor_property('easing').set_editor_property('AutoEaseInDuration',10,unreal.PropertyAccessChangeNotifyMode.NEVER)
I receive error
LogPython: Error: MovieSceneEasingSettings: Property
‘AutoEaseInDuration’ for attribute ‘AutoEaseInDuration’ on
‘MovieSceneEasingSettings’ is protected and cannot be set
How to provide easing with Python?

Related

Why i am getting this error while i am using modifier property to set width or height of layout functions like surface or column,

Modifier property error with width
i have using all things but never works
replace your imported package with:
import androidx.compose.ui.Modifier
import androidx.compose.foundation.layout.height

QML access properties of elements in list

I have a list of MapPolyline and I try to save dynamically added objects into this list. well It works but when I try to get the objects in list it does not work. it says TypeError: Cannot read property of undefined Here is my code
property list<MapPolyline> lines
var component;
var sprite;
component = Qt.createComponent("lineStringComponent.qml");
sprite = component.createObject(window,{"id": "button1"});
sprite.addCoordinate(QtPositioning.coordinate(currentgcppoint.lat, currentgcppoint.lon));
sprite.addCoordinate(gcppoint);
map.addMapItem(sprite)
lines.push(sprite)
gcps.push(currentgcppoint)
console.log("Added:", lines[1])
console.log("width:", lines[1].line.width)
Here is lineStringComponent.qml
import QtQuick 2.2
import QtLocation 5.6
import QtPositioning 5.6
MapPolyline {
id:polyline
line.width: 3
line.color: Qt.rgba(Math.random(),Math.random(),Math.random())
}
The consoles output is :
Added: undefined
TypeError: Cannot read property 'line' of undefined
It seems it has a delay when it tries to create a new object. How can we overcome this delay?
If I read your code correctly you only add 1 element to lines, and than you try to retrieve the second element of lines with line[1]. This is obviously undefined.
Try to access the first element of lines with line[0].
Indices of JS arrays start with 0 (as in most languages).
If there would be a delay with object creation, than you could not alter any of its properties, which you do (sprite.addCoordinate(...))

How to update a TableView in QML?

I am coding a program combining QML and C++. The TableView shows a column of a table. I can add or delete the record correctly, but I can not update the TableView, which always shows the content before adding or deleting.
How to update theTableView?
PS: I do not know whether it is good choice to code with QML and C++ instead of QWidget directly.
main()
{
//other code
......
MySqlModel *model = new MySqlModel;//class MySqlModel : public QSqlTableModel
model->QSqlQueryModel::setQuery("SELECT FieldName1 FROM Table");
QQmlApplicationEngine engine;
engine.rootContext()->setContextProperty ("SQQL", model);
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
//other code
......
}
In the qml:
TableView{
//other code
......
model: SQQL
//other code
......
}
QWidget-based has more default feature built-in, I would suggest you start from there.
how to enable edit
override flags function to enable edit on items, see
http://www.qtcentre.org/threads/38338-Can-t-edit-my-QTableView-cells
http://doc.qt.io/qt-4.8/qabstractitemview.html#EditTrigger-enum
how to sync changes back to db
you could manual commit the change per edit, or manually batch all changes in a db transaction, or you could just use sqltablemodel
http://doc.qt.io/qt-4.8/qsqltablemodel.html#EditStrategy-enum
However, if you need more flexible ui, or it is for a multi-touch device, you should go QML approach
make a qabstractview model
have qml view that bind to this qabstracttableview model. or using qt control tool kits

Passing QML events to C++ or VTK

How do I pass QML events to C++ code? I want to manage these events by passing them to a VTK interactor.
In QML code:
// some shape
Rectangle {
signal signalEvent333
onYourEvent: {
signalEvent333();
}
And in C++ code:
auto* qqView = new QQuickView(); // don't forget to delete sometimes
qqView->setSource(QUrl(QStringLiteral("qrc:///res/qml/myQmlForm.qml"))); // if that qml form in the app resource
QQuickItem* root = qqView->rootObject();
connect((QObject*)root, SIGNAL(signalEvent333()), this, SLOT(onSignalEvent333()));
We assume we have onSignalEvent333 slot for 'this' object.
P.S. And this question should be marked Qt as well. And I don't know what VTK is.

what is the format for saving a qml QVariantList<QVariant> in qml file so it can be bindable in qml when loading the file?

i am doing an application and i need to save the QVariantList list in a qml file so i can load it in qml every time i start the application
to make it more clear i read qpoints from qml and store them in a qvariantlist in c++ so the next step is to save it in text file i use the format(that's how i write it to file.qml)
import ARHandbook 1.0;
x:["1 2" , "1 3"]
but it doesnt load in qml so what is the right format to store it with ?
it gives this error unable to assin qvariantlist to void
For QtQuick 1.x, you should use property variant type, from QtQuick 2.0, you can just use property var to store array types.
See
http://doc-snapshot.qt-project.org/5.0/qml-var.html and http://qt-project.org/doc/qt-4.8/qml-variant.html for details.