Defold protobuff compiled to python package
Project description
defoldsdk
defold protbuff python
installling
pip install defoldsdk
usage :
all proto objects are under the namespace sdk
from defoldsdk import sdk
for i in sdk :
print(i)
x = sdk.Texture()
example load collection from string
from defoldsdk import sdk
from google.protobuf.json_format import MessageToJson
from google.protobuf.text_format import MessageToString, Parse
content = '''
name: "menu"
scale_along_z: 0
embedded_instances {
id: "go"
data: "components {\\n"
" id: \\"menu\\"\\n"
" component: \\"/examples/collection/proxy/menu.gui\\"\\n"
" position {\\n"
" x: 0.0\\n"
" y: 0.0\\n"
" z: 0.0\\n"
" }\\n"
" rotation {\\n"
" x: 0.0\\n"
" y: 0.0\\n"
" z: 0.0\\n"
" w: 1.0\\n"
" }\\n"
"}\\n"
""
position {
x: 0.0
y: 0.0
z: 0.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale3 {
x: 1.0
y: 1.0
z: 1.0
}
}
'''
collection = sdk.CollectionDesc()
Parse(content.encode('utf-8'), collection)
print(MessageToString(collection))
print(MessageToJson(collection,preserving_proto_field_name=True))
output :
name: "menu"
scale_along_z: 0
embedded_instances {
id: "go"
data: "components {\n id: \"menu\"\n component: \"/examples/collection/proxy/menu.gui\"\n position {\n x: 0.0\n y: 0.0\n z: 0.0\n }\n rotation {\n x: 0.0\n y: 0.0\n z: 0.0\n w: 1.0\n }\n}\n"
position {
x: 0.0
y: 0.0
z: 0.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale3 {
x: 1.0
y: 1.0
z: 1.0
}
}
{
"name": "menu",
"scale_along_z": 0,
"embedded_instances": [
{
"id": "go",
"data": "components {\n id: \"menu\"\n component: \"/examples/collection/proxy/menu.gui\"\n position {\n x: 0.0\n y: 0.0\n z: 0.0\n }\n rotation {\n x: 0.0\n y: 0.0\n z: 0.0\n w: 1.0\n }\n}\n",
"position": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"rotation": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"w": 1.0
},
"scale3": {
"x": 1.0,
"y": 1.0,
"z": 1.0
}
}
]
}```
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
defoldsdk-1.3.6.tar.gz
(28.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
defoldsdk-1.3.6-py3-none-any.whl
(47.0 kB
view details)
File details
Details for the file defoldsdk-1.3.6.tar.gz.
File metadata
- Download URL: defoldsdk-1.3.6.tar.gz
- Upload date:
- Size: 28.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6108f6096f4b4959bcb45a4b773f987510456ab1013abb4e1c26b41c78f321f0
|
|
| MD5 |
eccb5737f8d63570a2208a1433e5fefb
|
|
| BLAKE2b-256 |
11eb3e04ca081fa659cdcf805b142b44f75aac819face52728bb89e869b0ed4c
|
File details
Details for the file defoldsdk-1.3.6-py3-none-any.whl.
File metadata
- Download URL: defoldsdk-1.3.6-py3-none-any.whl
- Upload date:
- Size: 47.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b163405a47169a127630e171f038051311019457c3c277d62c30236471266dba
|
|
| MD5 |
454c18a962a73f30d214673551855389
|
|
| BLAKE2b-256 |
7e3b9f4712978c4c5bf028578a45801baa7f1961bcdcf7a18fab8aee18abda3e
|