Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP === Blender exporter plugin #790

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ bld/
[Bb]in/
[Oo]bj/

# Python build results
*.pyc
*.cpython*.so

# Roslyn cache directories
*.ide/

Expand Down
10 changes: 10 additions & 0 deletions BlenderExporter/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
set (SOURCE_FILES
python_bindings.cpp
)

find_package(pybind11 CONFIG REQUIRED)
pybind11_add_module(pywickedengine MODULE ${SOURCE_FILES})
target_compile_definitions(pywickedengine PUBLIC PYTHON_BINDINGS)
target_link_libraries(pywickedengine PUBLIC WickedEngine)
target_compile_definitions(pywickedengine PUBLIC "WICKED_ROOT_DIR=\"${WICKED_ROOT_DIR}\"")
install(TARGETS pywickedengine DESTINATION "~/.config/blender/4.0/scripts/addons/pywickedengine/")
369 changes: 369 additions & 0 deletions BlenderExporter/python_bindings.cpp

Large diffs are not rendered by default.

31 changes: 31 additions & 0 deletions BlenderExporter/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env python3

import os
import sys
importpath=os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(importpath, "wicked_blender_exporter"))
import pywickedengine

dump_to_header = False

def main():
pywickedengine.init()

filename = "/tmp/test.wiscene"
ar = pywickedengine.Archive() if dump_to_header else pywickedengine.Archive(filename, False)
if not ar.IsOpen():
print("ERROR, ARCHIVE DID NOT OPEN")
return

scene = pywickedengine.Scene()
scene.Serialize(ar)

if dump_to_header:
ar.SaveHeaderFile("/tmp/test.h","test")# wi::helper::RemoveExtension(wi::helper::GetFileNameFromPath(filename)));

ar.Close()

pywickedengine.deinit()

if __name__ == "__main__":
main()
Loading
Loading