Merge branch 'master' into xr-dev

This commit is contained in:
Peter Kim 2022-02-22 17:48:02 +09:00
commit be48defed8
5 changed files with 53 additions and 11 deletions

View File

@ -546,8 +546,10 @@ class AddXYZFunctionSurface(Operator):
obj = create_mesh_object(context, verts, [], faces, "XYZ Function")
if self.show_wire:
obj.show_wire = True
if self.show_wire:
context.active_object.show_wire = True
else:
context.active_object.show_wire = False
if self.edit_mode:
bpy.ops.object.mode_set(mode = 'EDIT')

View File

@ -9,11 +9,10 @@
bl_info = {
"name": "Curve Tools",
"description": "Adds some functionality for bezier/nurbs curve/surface modeling",
"author": "Mackraken",
"author": "Mackraken, Spivak Vladimir (cwolf3d)",
"version": (0, 4, 5),
"blender": (2, 80, 0),
"location": "View3D > Tool Shelf > Edit Tab",
"warning": "WIP",
"doc_url": "{BLENDER_MANUAL_URL}/addons/add_curve/curve_tools.html",
"category": "Add Curve",
}

View File

@ -453,9 +453,9 @@ class IV_OT_icons_show(bpy.types.Operator):
self.auto_focusable = True
num_cols = self.get_num_cols(len(pr.popup_icons.filtered_icons))
self.width = min(
self.width = int(min(
ui_scale() * (num_cols * ICON_SIZE + POPUP_PADDING),
context.window.width - WIN_PADDING)
context.window.width - WIN_PADDING))
return context.window_manager.invoke_props_dialog(
self, width=self.width)

View File

@ -173,7 +173,7 @@ class Do:
# type(self, dxf entity, blender curve data)
def _cubic_bezier_closed(self, ptuple, curve):
count = (len(ptuple)-1)/3
count = int((len(ptuple) - 1) / 3)
points = [ptuple[-2]]
ptuples = ptuple[:-2]
points += [p for p in ptuples]
@ -188,7 +188,7 @@ class Do:
b[i].handle_right = self.proj(points[j + 1])
def _cubic_bezier_open(self, points, curve):
count = (len(points) - 1) / 3 + 1
count = int((len(points) - 1) / 3 + 1)
spl = curve.splines.new('BEZIER')
b = spl.bezier_points
b.add(count - 1)

View File

@ -3,7 +3,7 @@
bl_info = {
"name": "Node Wrangler",
"author": "Bartek Skorupa, Greg Zaal, Sebastian Koenig, Christian Brinkmann, Florian Meyer",
"version": (3, 38),
"version": (3, 39),
"blender": (2, 93, 0),
"location": "Node Editor Toolbar or Shift-W",
"description": "Various tools to enhance and speed up node-based workflow",
@ -1137,6 +1137,22 @@ class NWPrincipledPreferences(bpy.types.PropertyGroup):
name='Displacement',
default='displacement displace disp dsp height heightmap',
description='Naming Components for displacement maps')
transmission: StringProperty(
name='Transmission',
default='transmission transparency',
description='Naming Components for transmission maps')
emission: StringProperty(
name='Emission',
default='emission emissive emit',
description='Naming Components for emission maps')
alpha: StringProperty(
name='Alpha',
default='alpha opacity',
description='Naming Components for alpha maps')
ambient_occlusion: StringProperty(
name='Ambient Occlusion',
default='ao ambient occlusion',
description='Naming Components for AO maps')
# Addon prefs
class NWNodeWrangler(bpy.types.AddonPreferences):
@ -1198,6 +1214,10 @@ class NWNodeWrangler(bpy.types.AddonPreferences):
col.prop(tags, "normal")
col.prop(tags, "bump")
col.prop(tags, "displacement")
col.prop(tags, "transmission")
col.prop(tags, "emission")
col.prop(tags, "alpha")
col.prop(tags, "ambient_occlusion")
box = layout.box()
col = box.column(align=True)
@ -3230,6 +3250,10 @@ class NWAddPrincipledSetup(Operator, NWBase, ImportHelper):
['Specular', tags.specular.split(' '), None],
['Roughness', rough_abbr + gloss_abbr, None],
['Normal', normal_abbr + bump_abbr, None],
['Transmission', tags.transmission.split(' '), None],
['Emission', tags.emission.split(' '), None],
['Alpha', tags.alpha.split(' '), None],
['Ambient Occlusion', tags.ambient_occlusion.split(' '), None],
]
# Look through texture_types and set value as filename of first matched file
@ -3266,6 +3290,7 @@ class NWAddPrincipledSetup(Operator, NWBase, ImportHelper):
print('\nMatched Textures:')
texture_nodes = []
disp_texture = None
ao_texture = None
normal_node = None
roughness_node = None
for i, sname in enumerate(socketnames):
@ -3282,7 +3307,8 @@ class NWAddPrincipledSetup(Operator, NWBase, ImportHelper):
# Add displacement offset nodes
disp_node = nodes.new(type='ShaderNodeDisplacement')
disp_node.location = active_node.location + Vector((0, -560))
# Align the Displacement node under the active Principled BSDF node
disp_node.location = active_node.location + Vector((100, -700))
link = links.new(disp_node.inputs[0], disp_texture.outputs[0])
# TODO Turn on true displacement in the material
@ -3296,6 +3322,17 @@ class NWAddPrincipledSetup(Operator, NWBase, ImportHelper):
continue
# AMBIENT OCCLUSION TEXTURE
if sname[0] == 'Ambient Occlusion':
ao_texture = nodes.new(type='ShaderNodeTexImage')
img = bpy.data.images.load(path.join(import_path, sname[2]))
ao_texture.image = img
ao_texture.label = sname[0]
if ao_texture.image:
ao_texture.image.colorspace_settings.is_data = True
continue
if not active_node.inputs[sname[0]].is_linked:
# No texture node connected -> add texture node with new image
texture_node = nodes.new(type='ShaderNodeTexImage')
@ -3343,7 +3380,7 @@ class NWAddPrincipledSetup(Operator, NWBase, ImportHelper):
link = links.new(active_node.inputs[sname[0]], texture_node.outputs[0])
# Use non-color for all but 'Base Color' Textures
if not sname[0] in ['Base Color'] and texture_node.image:
if not sname[0] in ['Base Color', 'Emission'] and texture_node.image:
texture_node.image.colorspace_settings.is_data = True
else:
@ -3357,6 +3394,10 @@ class NWAddPrincipledSetup(Operator, NWBase, ImportHelper):
if disp_texture:
texture_nodes.append(disp_texture)
if ao_texture:
# We want the ambient occlusion texture to be the top most texture node
texture_nodes.insert(0, ao_texture)
# Alignment
for i, texture_node in enumerate(texture_nodes):
offset = Vector((-550, (i * -280) + 200))