Skip to content
Merged
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
26 changes: 24 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:
asset_name: conduct.exe
asset_content_type: application/octet-stream

release-integrations:
release-blender-integration:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -107,4 +107,26 @@ jobs:
upload_url: ${{ github.event.release.upload_url }}
asset_path: integration/conduct-blender.zip
asset_name: conduct-blender.zip
asset_content_type: application/zip
asset_content_type: application/zip

release-inkscape-integration:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Zip Inkscape Integration
run: |
cd integration
mv inkscape conduct-inkscape
zip -r conduct-inkscape.zip conduct-inkscape

- name: Upload to release
if: github.event_name == 'release'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: integration/conduct-inkscape.zip
asset_name: conduct-inkscape.zip
asset_content_type: application/zip
11 changes: 11 additions & 0 deletions example/basic/manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ programs:
.glb: import_glb_mesh.py
.shadergraph.blend: import_blend_shadergraph.py
.mesh.blend: import_blend_library_mesh.py
inkscape:
exports:
.png: export_png_512.py
.2x.png: export_png_1024.py

departments:
anim:
Expand Down Expand Up @@ -72,6 +76,13 @@ assets:
departments:
layout:
- !depends(defaultCubeA;defaultCubeB) cubeInstancer
2d:
icons:
- iconA:
departments:
design:
- vector
- 2x

shots:
'103':
Expand Down
33 changes: 33 additions & 0 deletions example/basic/scripts/inkscape/export_png_1024.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

class InkscapeDataExport():

def log(self, object):
import inkex
inkex.utils.debug(object)

def export(self, effect_context, directory=None, file_name=None, extension=None, items=None, ):
from tempfile import TemporaryDirectory
import inkex
import os

with TemporaryDirectory(prefix='inkscape-command-') as tmpdir:

svg_file = inkex.command.write_svg(effect_context.svg, tmpdir, 'input.svg')
output = os.path.join(directory, file_name + extension)

pages = effect_context.svg.namedview.get_pages()
index = pages.index(items[0])

page = items[0]

height = 1024
ratio = page.width / page.height
width = round(ratio * height)

out = inkex.command.inkscape(svg_file,
"--export-filename=%s" % output,
'--export-type=png',
'--export-width=%d' % width,
'--export-height=%d' % height,
'--export-page=%d' % (index + 1))

33 changes: 33 additions & 0 deletions example/basic/scripts/inkscape/export_png_512.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

class InkscapeDataExport():

def log(self, object):
import inkex
inkex.utils.debug(object)

def export(self, effect_context, directory=None, file_name=None, extension=None, items=None, ):
from tempfile import TemporaryDirectory
import inkex
import os

with TemporaryDirectory(prefix='inkscape-command-') as tmpdir:

svg_file = inkex.command.write_svg(effect_context.svg, tmpdir, 'input.svg')
output = os.path.join(directory, file_name + extension)

pages = effect_context.svg.namedview.get_pages()
index = pages.index(items[0])

page = items[0]

height = 512
ratio = page.width / page.height
width = round(ratio * height)

out = inkex.command.inkscape(svg_file,
"--export-filename=%s" % output,
'--export-type=png',
'--export-width=%d' % width,
'--export-height=%d' % height,
'--export-page=%d' % (index + 1))

165 changes: 165 additions & 0 deletions example/basic/setup/asset/design/iconA/iconA_design.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 22 additions & 6 deletions integration/common/conduct.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
import subprocess
import json

def log(info):
print(info)

class Conduct:
conduct_exe = ""
current_program = ""
Expand All @@ -24,12 +27,13 @@ def run_process(self, args):
startupinfo.dwFlags = subprocess.CREATE_NO_WINDOW
creation_flags = subprocess.CREATE_NO_WINDOW

print("Executing: " + str(args))
log("Executing: " + str(args))

process=subprocess.Popen(args, cwd=os.path.dirname(self.conduct_exe), startupinfo=startupinfo, stdout=subprocess.PIPE, encoding='utf-8', creationflags=creation_flags)
process=subprocess.Popen(args, cwd=os.path.dirname(self.conduct_exe), startupinfo=startupinfo, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, encoding='utf-8', creationflags=creation_flags)

data = process.communicate()[0]
print(data)

log(data)

return json.loads(data)

Expand All @@ -53,6 +57,18 @@ def dialog_load_asset(self, department, shot=None, asset=None ):

return self.run_process(args)

def dialog_export(self, department, asset, items, prev_state=None, shot=None, ):
args = ["dialog", "export", "--", "--program", self.current_program, "--department", department, "--asset", asset, "--items", items ]
if shot != None and shot != "":
args.append("--shot")
args.append(shot)

if prev_state != None and prev_state != "":
args.append("--prev-state")
args.append(prev_state)

return self.run_process(args)

def list_export_formats(self, department):
return self.run_process(["list-export-formats", "--from", self.current_program, "--department", department])

Expand All @@ -65,7 +81,7 @@ def export(self, department, format, asset, element, shot=None):
return self.run_process(args)

def get_from_manifest_path(manifest_path, current_program):
print("Getting exe from manifest path: " + manifest_path)
log("Getting exe from manifest path: " + manifest_path)

dir_path = os.path.dirname(manifest_path)
exe = "conduct"
Expand All @@ -76,7 +92,7 @@ def get_from_manifest_path(manifest_path, current_program):
return Conduct(path, current_program)

def find_from_current_path(current_file, current_program):
print("Looking for conduct path for file: " + current_file)
log("Looking for conduct path for file: " + current_file)
path = os.path.dirname(current_file)
while path != "":
checks = [
Expand All @@ -86,7 +102,7 @@ def find_from_current_path(current_file, current_program):

for check in checks:
if os.path.isfile(check):
print("found:" + check)
log("found:" + check)
return get_from_manifest_path(check, current_program)

path = os.path.dirname(path)
Expand Down
1 change: 1 addition & 0 deletions integration/inkscape/conduct
15 changes: 15 additions & 0 deletions integration/inkscape/conduct_create_setup.inx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
<name>Create Setup</name>
<id>com.lagmachine.conduct.create_setup</id>
<param type="path" name="manifest" gui-text="Manifest File" mode="file" filetypes="yaml,yml" />
<effect needs-live-preview="false" show-stderr="true">
<object-type>all</object-type>
<effects-menu>
<submenu name="Conduct" />
</effects-menu>
</effect>
<script>
<command location="inx" interpreter="python">conduct_create_setup.py</command>
</script>
</inkscape-extension>
Loading