Skip to content

Commit

Permalink
Update externaldragdrop.py
Browse files Browse the repository at this point in the history
Supports Octane and Karma
  • Loading branch information
LewisOrton authored Apr 8, 2024
1 parent 69970eb commit 6e725bb
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions scripts/externaldragdrop.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@ def import_file(network_node, file_path, file_basename, file_ext, cursor_positio
while parent.type().name() == "subnet":
parent = parent.parent()
net_type_name = parent.type().name()

#karma detection
if net_type_name == "materiallibrary":
test_nodes = network_node.children()
for test_node in test_nodes:
if test_node.type().name()[:4] == "mtlx" or "kma":
net_type_name = "karma_subnet"
break

if net_type_name in {"geo","sopnet"}:
if file_ext == ".abc":
Expand Down Expand Up @@ -112,6 +120,15 @@ def import_file(network_node, file_path, file_basename, file_ext, cursor_positio
elif net_type_name in {"lopnet","stage"}:
create_new_node(network_node, file_path, "reference", "filepath1", cursor_position, name = file_name)
return True
elif net_type_name == "karma_subnet":
create_new_node(network_node, file_path, "mtlximage", "file", cursor_position, name = file_name)
return True
elif net_type_name == "octane_vopnet":
octane_texture = create_new_node(network_node, file_path, "octane::NT_TEX_IMAGE", "A_FILENAME", cursor_position, name = file_name)
octane_transform = network_node.createNode("octane::NT_TRANSFORM_2D")
octane_transform.setPosition(cursor_position - hou.Vector2(2,0.8))
octane_texture.setInput(5, octane_transform, 0)
return True
return False

def create_new_node(network_node, file_path, node_name, parm_path_name, cursor_position, **kwargs):
Expand Down

0 comments on commit 6e725bb

Please sign in to comment.