diff --git a/blender/osci_render/__init__.py b/blender/osci_render/__init__.py
index ac76f2e..80b611d 100644
--- a/blender/osci_render/__init__.py
+++ b/blender/osci_render/__init__.py
@@ -1,7 +1,7 @@
bl_info = {
"name": "osci-render",
"author": "James Ball",
- "version": (1, 0, 0),
+ "version": (1, 0, 2),
"blender": (3, 1, 2),
"location": "View3D",
"description": "Addon to send gpencil frames over to osci-render",
@@ -14,6 +14,7 @@ import bpy
import bmesh
import socket
import json
+from bpy.app.handlers import persistent
HOST = "localhost"
PORT = 51677
@@ -82,8 +83,8 @@ def append_matrix(object_info, obj):
return object_info
+@persistent
def send_scene_to_osci_render(scene):
- col = bpy.context.scene.collection["osci_render"]
engine_info = {"objects": []}
if sock is not None:
@@ -120,9 +121,9 @@ def register():
def unregister():
- bpy.app.handlers.frame_change_pre.clear()
- bpy.app.handlers.depsgraph_update_post.clear()
- for operation in operations.reverse():
+ bpy.app.handlers.frame_change_pre.remove(send_scene_to_osci_render)
+ bpy.app.handlers.depsgraph_update_post.remove(send_scene_to_osci_render)
+ for operation in reversed(operations):
bpy.utils.unregister_class(operation)
diff --git a/pom.xml b/pom.xml
index ca2447b..84c95ce 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
sh.ball
osci-render
- 1.21.1
+ 1.22.0
osci-render
diff --git a/src/main/java/sh/ball/engine/CameraDrawKernel.java b/src/main/java/sh/ball/engine/CameraDrawKernel.java
index c0c52d2..0fa6158 100644
--- a/src/main/java/sh/ball/engine/CameraDrawKernel.java
+++ b/src/main/java/sh/ball/engine/CameraDrawKernel.java
@@ -95,7 +95,9 @@ public class CameraDrawKernel extends Kernel {
this.cameraPosY = 0;
this.cameraPosZ = 0;
- return executeKernel();
+ this.hideEdges = 0;
+
+ return executeKernel(true);
}
public List draw(Camera camera, WorldObject object) {
@@ -123,24 +125,27 @@ public class CameraDrawKernel extends Kernel {
this.cameraPosZ = (float) cameraPos.z;
this.focalLength = (float) camera.getFocalLength();
- hideEdges = object.edgesHidden() ? 1 : 0;
- return executeKernel();
+ this.hideEdges = object.edgesHidden() ? 1 : 0;
+
+ return executeKernel(false);
}
- private List executeKernel() {
- int maxGroupSize = 256;
- try {
- maxGroupSize = getKernelMaxWorkGroupSize(getTargetDevice());
- } catch (QueryFailedException e) {
- e.printStackTrace();
- }
+ private List executeKernel(boolean cpu) {
+ if (cpu) {
+ for (int i = 0; i < vertices.length / 3; i++) {
+ processVertex(i);
+ }
+ } else {
+ int maxGroupSize = 256;
+ try {
+ maxGroupSize = getKernelMaxWorkGroupSize(getTargetDevice());
+ } catch (QueryFailedException e) {
+ e.printStackTrace();
+ }
- for (int i = 0; i < vertices.length / 3; i++) {
- processVertex(i);
+ execute(Range.create(roundUp(vertices.length / 3, maxGroupSize), maxGroupSize));
}
- //execute(Range.create(roundUp(vertices.length / 3, maxGroupSize), maxGroupSize));
-
List linesList = new ArrayList<>();
for (int i = 0; i < vertices.length / 3; i++) {