How to create simple settings in plugin?
AnsweredI just wanted to create a simple setting for receiving text. For that i have modified code below.
//plugin.cpp
stringMyPlugin::manifestString() const
{
return /*suppress newline*/1 + R"json(
{
"id": "amnimo.sample.zeromq",
"name": "amnimo sample zero mq plugin",
"description": "Sample to use zero mq integration with Protobuf",
"version": "1.0.0",
"vendor": "amnimo",
"engineSettingsModel": {
"type": "Settings",
"items": [
{
"type": "TextField",
"name": "text",
"caption": "Text Field",
"description": "A text field",
"defaultValue": "a text"
}
]
}
}
)json";
}
//engine.cpp
string MyEngine::manifestString() const
{
// Ask the Server to supply uncompressed video frames in YUV420 format (see https://en.wikipedia.org/wiki/YUV).
// Note that this format is used internally by the Server, therefore requires minimum resources for decoding, thus it is the recommended format.
// needUncompressedVideoFrames_yuv420
// needUncompressedVideoFrames_rgb
// needUncompressedVideoFrames_bgr(native for OpenCV)
return /*suppress newline*/1 + R"json(
{
"capabilities": "needUncompressedVideoFrames_rgb"
},
"objectActions": [
{
"id": "nx.stub.addToList",
"name": "Add to list",
"parametersModel": {
"type": "Settings",
"items": [
{
"type": "TextField",
"name": "testTextField",
"caption": "Text Field Parameter",
"description": "A text field",
"defaultValue": "a text"
}
]
}
}
]
)json";
}
I am able create plugin. But, NX client is not displying the text box field which I expected. How to add text box in plugin settings. Is there any documentation for how to create settings in plugin?
-
Hello Mohamed,
Is there any documentation for how to create settings in plugin?
See these files of the Metadata SDK
metadata_sdk/src/nx/sdk/analytics/manifests.md
metadata_sdk/src/nx/sdk/settings_model.mdI am able create plugin. But, NX client is not displying the text box field which I expected.
Most probably, your manifest JSON is not correctly formatted.
You have totally wrong structure of the Engine manifest. That's the root cause.
In your case, it should be similar to this:return /*suppress newline*/1 + R"json(
{
"capabilities": "needUncompressedVideoFrames_rgb",
"objectActions": [
{
"id": "nx.stub.addToList",
"name": "Add to list"
.....
},
{
"id": "nx.stub.SomeNewId",
"name": "a new name"
}
]
}
)json";Please, revise carefully your manifests while reading documentation in the .md files.
Pay your attention, objectAction object can't have the "items".
0 -
I am able to get settings
0
Please sign in to leave a comment.
Comments
2 comments