Skip to main content

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


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.3.tar.gz (28.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

defoldsdk-1.3.3-py3-none-any.whl (47.0 kB view details)

Uploaded Python 3

File details

Details for the file defoldsdk-1.3.3.tar.gz.

File metadata

  • Download URL: defoldsdk-1.3.3.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

Hashes for defoldsdk-1.3.3.tar.gz
Algorithm Hash digest
SHA256 644bedd4108cc1a6e6013e2d1a3b31988ad1d74917c1990063ccdaee64284f87
MD5 45889853707f2903bf48bcf7b3e09564
BLAKE2b-256 b9f02670a1a285ddcf5a354cb6c83a6cb3d01e4a7fd10fcac55b1af15d4c7abb

See more details on using hashes here.

File details

Details for the file defoldsdk-1.3.3-py3-none-any.whl.

File metadata

  • Download URL: defoldsdk-1.3.3-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

Hashes for defoldsdk-1.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 30dbf5b8b70976bdeafcf26ad4403c1038f3666a026b21ac72d96607f688aa1a
MD5 1bfe3e652c451301cd11b3fb336d0674
BLAKE2b-256 7c3f25f4373b16e58e9922496ad0d442bc58cb67d9d91b302be6646c1599b427

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page