Skip to content

Commit

Permalink
gets new node location randomly depending on how many nodes there are
Browse files Browse the repository at this point in the history
  • Loading branch information
AnimNyan committed Jul 11, 2022
1 parent 9984618 commit 009db69
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 19 deletions.
4 changes: 2 additions & 2 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
bl_info = {
"name": "LightWanda Importer",
"author": "Ken Nign (Ken9) and Gert De Roost, Wisi, ASapphicKitsune and Anime Nyan",
"version": (1, 4, 2),
"blender": (3, 0, 0),
"version": (1, 4, 3),
"blender": (3, 2, 0),
"location": "File > Import > LightWave Object (.lwo)",
"description": "Imports a LWO file including any UV, Morph and Color maps. "
"Can convert Skeletons to an Armature.",
Expand Down
20 changes: 3 additions & 17 deletions io_import_scene_lwo.py
Original file line number Diff line number Diff line change
Expand Up @@ -1339,13 +1339,11 @@ def build_objects(object_layers, object_surfs, object_clips, object_tags, object
vertex_color_node = curr_material.node_tree.nodes.new('ShaderNodeVertexColor')

#position x, y
vertex_color_node.location = get_new_node_location(curr_material)
vertex_color_node.location = (-800, 0)

#create a mixRGB node
mix_rgb_tint_node = curr_material.node_tree.nodes.new('ShaderNodeMixRGB')

mix_rgb_tint_node.location = get_new_node_location(curr_material)

mix_rgb_tint_node.blend_type = 'MULTIPLY'
mix_rgb_tint_node.inputs["Fac"].default_value = 1

Expand Down Expand Up @@ -1457,7 +1455,7 @@ def build_objects(object_layers, object_surfs, object_clips, object_tags, object
vertex_color_node_2 = curr_material.node_tree.nodes.new('ShaderNodeVertexColor')

#position x, y
vertex_color_node_2.location = get_new_node_location(curr_material)
vertex_color_node_2.location = (-900, -200)

#-------------------------------------------------------NEED TO CHANGE IS HARDCODED
#-------------------------------------------------------
Expand Down Expand Up @@ -1573,7 +1571,7 @@ def build_objects(object_layers, object_surfs, object_clips, object_tags, object
uv_map_node = curr_material.node_tree.nodes.new('ShaderNodeUVMap')

#position x, y
uv_map_node.location = get_new_node_location(curr_material)
uv_map_node.location = (-600, 150)

material_link(uv_map_node.outputs["UV"], image_texture_node.inputs["Vector"])
#image_texture_node.uv_layer = texture.uvname
Expand Down Expand Up @@ -2007,18 +2005,6 @@ def build_objects(object_layers, object_surfs, object_clips, object_tags, object

print("Done Importing LWO File")

#return a different (x,y) position
#this depends upon how many nodes currently exist
#so every node will return a different x and y position
def get_new_node_location(curr_material):
count = len(curr_material.node_tree.nodes)

x_location = count * -150
y_location = count * -20

return (x_location,y_location)



from bpy.props import StringProperty, BoolProperty, CollectionProperty

Expand Down

0 comments on commit 009db69

Please sign in to comment.