Skip to content

Commit

Permalink
fix: bpy_prop_array import location change
Browse files Browse the repository at this point in the history
  • Loading branch information
BrendanParmer committed Nov 17, 2024
1 parent 1a520d1 commit 4269432
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions NodeToPython/ntp_operator.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
import bpy
from bpy.types import Context, Operator
from bpy.types import Node, NodeTree
from bpy_types import bpy_types

if bpy.app.version < (4, 0, 0):
from bpy.types import NodeSocketInterface
else:
from bpy.types import NodeTreeInterfacePanel, NodeTreeInterfaceSocket
from bpy.types import NodeTreeInterfaceItem

if bpy.app.version >= (4, 3, 0):
from bpy.types import bpy_prop_array
else:
from bpy_types.bpy_types import bpy_prop_array

import datetime
import os
import shutil
Expand Down Expand Up @@ -574,7 +578,7 @@ def _set_tree_socket_defaults(self, socket_interface: NodeTreeInterfaceSocket,
dv = vec4_to_py_str(dv)
elif type(dv) in {mathutils.Vector, mathutils.Euler}:
dv = vec3_to_py_str(dv)
elif type(dv) == bpy_types.bpy_prop_array:
elif type(dv) == bpy_prop_array:
dv = array_to_py_str(dv)
elif type(dv) == str:
dv = str_to_py_str(dv)
Expand Down
8 changes: 6 additions & 2 deletions NodeToPython/utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import bpy
from bpy_types import bpy_types
import mathutils

if bpy.app.version >= (4, 3, 0):
from bpy.types import bpy_prop_array
else:
from bpy_types.bpy_types import bpy_prop_array

import keyword
import re

Expand Down Expand Up @@ -106,7 +110,7 @@ def vec4_to_py_str(vec4) -> str:
"""
return f"({vec4[0]}, {vec4[1]}, {vec4[2]}, {vec4[3]})"

def array_to_py_str(array: bpy_types.bpy_prop_array) -> str:
def array_to_py_str(array: bpy_prop_array) -> str:
"""
Converts a bpy_prop_array into a string
Expand Down

0 comments on commit 4269432

Please sign in to comment.