Cleanup: trailing space
This commit is contained in:
parent
6051a29b0a
commit
fe59d382b4
|
@ -60,7 +60,7 @@ class GreasePencilAddonPrefs(bpy.types.AddonPreferences):
|
|||
('layer_navigator', 'Layer Navigator', 'Layer Navigation tool shortcut and prefs', 3),
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
# --- props
|
||||
|
||||
use_clic_drag : BoolProperty(
|
||||
|
@ -153,7 +153,7 @@ class GreasePencilAddonPrefs(bpy.types.AddonPreferences):
|
|||
|
||||
row = layout.row(align=True)
|
||||
row.prop(self, "pref_tab", expand=True)
|
||||
|
||||
|
||||
if self.pref_tab == 'box_deform':
|
||||
|
||||
## BOX DEFORM
|
||||
|
@ -213,7 +213,7 @@ class GreasePencilAddonPrefs(bpy.types.AddonPreferences):
|
|||
## SCRUB TIMELINE
|
||||
box = layout.box()
|
||||
draw_ts_pref(prefs.ts, box)
|
||||
|
||||
|
||||
if self.pref_tab == 'layer_navigator':
|
||||
## LAYER NAVIGATOR
|
||||
box = layout.box()
|
||||
|
|
|
@ -360,7 +360,7 @@ class ExportGLTF2_Base(ConvertGLTF2_Base):
|
|||
use_active_collection: BoolProperty(
|
||||
name='Active Collection',
|
||||
description='Export objects in the active collection only',
|
||||
default=False
|
||||
default=False
|
||||
)
|
||||
|
||||
use_active_scene: BoolProperty(
|
||||
|
@ -626,7 +626,7 @@ class ExportGLTF2_Base(ConvertGLTF2_Base):
|
|||
|
||||
export_settings['gltf_visible'] = self.use_visible
|
||||
export_settings['gltf_renderable'] = self.use_renderable
|
||||
|
||||
|
||||
export_settings['gltf_active_collection'] = self.use_active_collection
|
||||
if self.use_active_collection:
|
||||
export_settings['gltf_active_collection_with_nested'] = self.use_active_collection_with_nested
|
||||
|
|
|
@ -125,4 +125,4 @@ def get_attribute_type(component_type, data_type):
|
|||
gltf2_io_constants.ComponentType.UnsignedShort: "BYTE_COLOR"
|
||||
}[component_type]
|
||||
else:
|
||||
pass
|
||||
pass
|
||||
|
|
|
@ -44,4 +44,4 @@ def get_delta_modes(target_property: str) -> str:
|
|||
return target_property.startswith("delta_")
|
||||
|
||||
def is_bone_anim_channel(data_path: str) -> bool:
|
||||
return data_path[:10] == "pose.bones"
|
||||
return data_path[:10] == "pose.bones"
|
||||
|
|
|
@ -10,7 +10,7 @@ def create_gltf_ao_group(operator, group_name):
|
|||
|
||||
# create a new group
|
||||
gltf_ao_group = bpy.data.node_groups.new(group_name, "ShaderNodeTree")
|
||||
|
||||
|
||||
return gltf_ao_group
|
||||
|
||||
class NODE_OT_GLTF_SETTINGS(bpy.types.Operator):
|
||||
|
@ -143,8 +143,8 @@ class SCENE_OT_gltf2_variant_remove(bpy.types.Operator):
|
|||
if len(remove_idx_data) > 0:
|
||||
for idx_data in remove_idx_data:
|
||||
mesh.gltf2_variant_mesh_data.remove(idx_data)
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
# Operator to display a variant
|
||||
|
|
|
@ -187,7 +187,7 @@ def __get_image_data(sockets, export_settings) -> ExportImage:
|
|||
return __get_image_data_specular(sockets, results, export_settings)
|
||||
else:
|
||||
return __get_image_data_mapping(sockets, results, export_settings)
|
||||
|
||||
|
||||
def __get_image_data_mapping(sockets, results, export_settings) -> ExportImage:
|
||||
"""
|
||||
Simple mapping
|
||||
|
@ -266,7 +266,7 @@ def __get_image_data_mapping(sockets, results, export_settings) -> ExportImage:
|
|||
def __get_image_data_specular(sockets, results, export_settings) -> ExportImage:
|
||||
"""
|
||||
calculating Specular Texture, settings needed data
|
||||
"""
|
||||
"""
|
||||
from io_scene_gltf2.blender.exp.gltf2_blender_texture_specular import specular_calculation
|
||||
composed_image = ExportImage()
|
||||
composed_image.set_calc(specular_calculation)
|
||||
|
|
|
@ -261,7 +261,7 @@ def __gather_extensions(blender_material, emissive_factor, export_settings):
|
|||
sheen_extension, use_actives_uvmap_sheen = export_sheen(blender_material, export_settings)
|
||||
if sheen_extension:
|
||||
extensions["KHR_materials_sheen"] = sheen_extension
|
||||
actives_uvmaps.extend(use_actives_uvmap_sheen)
|
||||
actives_uvmaps.extend(use_actives_uvmap_sheen)
|
||||
|
||||
# KHR_materials_ior
|
||||
# Keep this extension at the end, because we export it only if some others are exported
|
||||
|
|
|
@ -78,4 +78,4 @@ def export_clearcoat(blender_material, export_settings):
|
|||
if clearcoat_normal_texture_use_active_uvmap:
|
||||
use_actives_uvmaps.append("clearcoatNormalTexture")
|
||||
|
||||
return Extension('KHR_materials_clearcoat', clearcoat_extension, False), use_actives_uvmaps
|
||||
return Extension('KHR_materials_clearcoat', clearcoat_extension, False), use_actives_uvmaps
|
||||
|
|
|
@ -58,4 +58,4 @@ def export_emission_strength_extension(emissive_factor, export_settings):
|
|||
emissive_strength_extension = {}
|
||||
emissive_strength_extension['emissiveStrength'] = max(emissive_factor)
|
||||
|
||||
return Extension('KHR_materials_emissive_strength', emissive_strength_extension, False)
|
||||
return Extension('KHR_materials_emissive_strength', emissive_strength_extension, False)
|
||||
|
|
|
@ -32,4 +32,4 @@ def export_ior(blender_material, extensions, export_settings):
|
|||
ior_extension = {}
|
||||
ior_extension['ior'] = ior_socket.default_value
|
||||
|
||||
return Extension('KHR_materials_ior', ior_extension, False)
|
||||
return Extension('KHR_materials_ior', ior_extension, False)
|
||||
|
|
|
@ -33,7 +33,7 @@ def export_sheen(blender_material, export_settings):
|
|||
fac = [1.0, 1.0, 1.0] # Default is 0.0/0.0/0.0, so we need to set it to 1 if no factor
|
||||
if fac is not None and fac != [0.0, 0.0, 0.0]:
|
||||
sheen_extension['sheenColorFactor'] = fac
|
||||
|
||||
|
||||
# Texture
|
||||
if gltf2_blender_get.has_image_node_from_socket(sheenColor_socket):
|
||||
original_sheenColor_texture, original_sheenColor_use_active_uvmap, _ = gltf2_blender_gather_texture_info.gather_texture_info(
|
||||
|
@ -57,7 +57,7 @@ def export_sheen(blender_material, export_settings):
|
|||
fac = 1.0 # Default is 0.0 so we need to set it to 1.0 if no factor
|
||||
if fac is not None and fac != 0.0:
|
||||
sheen_extension['sheenRoughnessFactor'] = fac
|
||||
|
||||
|
||||
# Texture
|
||||
if gltf2_blender_get.has_image_node_from_socket(sheenRoughness_socket):
|
||||
original_sheenRoughness_texture, original_sheenRoughness_use_active_uvmap, _ = gltf2_blender_gather_texture_info.gather_texture_info(
|
||||
|
@ -68,5 +68,5 @@ def export_sheen(blender_material, export_settings):
|
|||
sheen_extension['sheenRoughnessTexture'] = original_sheenRoughness_texture
|
||||
if original_sheenRoughness_use_active_uvmap:
|
||||
use_actives_uvmaps.append("sheenRoughnessTexture")
|
||||
|
||||
|
||||
return Extension('KHR_materials_sheen', sheen_extension, False), use_actives_uvmaps
|
||||
|
|
|
@ -34,7 +34,7 @@ def export_original_specular(blender_material, export_settings):
|
|||
fac = gltf2_blender_get.get_factor_from_socket(original_specular_socket, kind='VALUE')
|
||||
if fac is not None and fac != 1.0:
|
||||
specular_extension['specularFactor'] = fac
|
||||
|
||||
|
||||
# Texture
|
||||
if gltf2_blender_get.has_image_node_from_socket(original_specular_socket):
|
||||
original_specular_texture, original_specular_use_active_uvmap, _ = gltf2_blender_gather_texture_info.gather_texture_info(
|
||||
|
@ -67,7 +67,7 @@ def export_original_specular(blender_material, export_settings):
|
|||
specular_extension['specularColorTexture'] = original_specularcolor_texture
|
||||
if original_specularcolor_use_active_uvmap:
|
||||
use_actives_uvmaps.append("specularColorTexture")
|
||||
|
||||
|
||||
return Extension('KHR_materials_specular', specular_extension, False), use_actives_uvmaps
|
||||
|
||||
def export_specular(blender_material, export_settings):
|
||||
|
@ -117,7 +117,7 @@ def export_specular(blender_material, export_settings):
|
|||
l = luminance(c)
|
||||
if l == 0:
|
||||
return np.array(c)
|
||||
return np.array([c[0] / l, c[1] / l, c[2] / l])
|
||||
return np.array([c[0] / l, c[1] / l, c[2] / l])
|
||||
|
||||
f0_from_ior = ((ior - 1)/(ior + 1))**2
|
||||
if f0_from_ior == 0:
|
||||
|
@ -151,8 +151,8 @@ def export_specular(blender_material, export_settings):
|
|||
primary_socket = transmission_socket
|
||||
|
||||
specularColorTexture, use_active_uvmap, specularColorFactor = gltf2_blender_gather_texture_info.gather_texture_info(
|
||||
primary_socket,
|
||||
sockets,
|
||||
primary_socket,
|
||||
sockets,
|
||||
export_settings,
|
||||
filter_type='ANY')
|
||||
if specularColorTexture is None:
|
||||
|
@ -166,7 +166,7 @@ def export_specular(blender_material, export_settings):
|
|||
|
||||
if specularColorFactor is not None:
|
||||
specular_extension['specularColorFactor'] = specularColorFactor
|
||||
|
||||
|
||||
|
||||
specular_extension = Extension('KHR_materials_specular', specular_extension, False) if specular_ext_enabled else None
|
||||
return specular_extension, use_actives_uvmaps
|
||||
return specular_extension, use_actives_uvmaps
|
||||
|
|
|
@ -44,4 +44,4 @@ def export_transmission(blender_material, export_settings):
|
|||
if use_active_uvmap:
|
||||
use_actives_uvmaps.append("transmissionTexture")
|
||||
|
||||
return Extension('KHR_materials_transmission', transmission_extension, False), use_actives_uvmaps
|
||||
return Extension('KHR_materials_transmission', transmission_extension, False), use_actives_uvmaps
|
||||
|
|
|
@ -317,7 +317,7 @@ def __gather_trans_rot_scale(vnode, export_settings):
|
|||
if export_settings['vtree'].nodes[vnode.parent_uuid].skin is None:
|
||||
trans, rot, sca = (export_settings['vtree'].nodes[vnode.parent_uuid].matrix_world.inverted_safe() @ vnode.matrix_world).decompose()
|
||||
else:
|
||||
# But ... if parent has skin, the parent TRS are not taken into account, so don't get local from parent, but from armature
|
||||
# But ... if parent has skin, the parent TRS are not taken into account, so don't get local from parent, but from armature
|
||||
# It also depens if skined mesh is parented to armature or not
|
||||
if export_settings['vtree'].nodes[vnode.parent_uuid].parent_uuid is not None and export_settings['vtree'].nodes[export_settings['vtree'].nodes[vnode.parent_uuid].parent_uuid].blender_type == VExportNode.ARMATURE:
|
||||
trans, rot, sca = (export_settings['vtree'].nodes[export_settings['vtree'].nodes[vnode.parent_uuid].armature].matrix_world.inverted_safe() @ vnode.matrix_world).decompose()
|
||||
|
|
|
@ -152,7 +152,7 @@ class PrimitiveCreator:
|
|||
attr['blender_domain'] = blender_attribute.domain
|
||||
attr['blender_data_type'] = blender_attribute.data_type
|
||||
|
||||
# For now, we don't export edge data, because I need to find how to
|
||||
# For now, we don't export edge data, because I need to find how to
|
||||
# get from edge data to dots data
|
||||
if attr['blender_domain'] == "EDGE":
|
||||
continue
|
||||
|
@ -386,7 +386,7 @@ class PrimitiveCreator:
|
|||
attr['set'](attr)
|
||||
else: # Regular case
|
||||
self.__set_regular_attribute(attr)
|
||||
|
||||
|
||||
if self.skin:
|
||||
joints = [[] for _ in range(self.num_joint_sets)]
|
||||
weights = [[] for _ in range(self.num_joint_sets)]
|
||||
|
@ -558,7 +558,7 @@ class PrimitiveCreator:
|
|||
self.__get_normal_attribute(attr)
|
||||
elif attr['gltf_attribute_name'] == "TANGENT":
|
||||
self.__get_tangent_attribute(attr)
|
||||
|
||||
|
||||
return getting_function
|
||||
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ def __filter_texture_info(primary_socket, blender_shader_sockets, filter_type, e
|
|||
if all([__get_tex_from_socket(socket) is None for socket in blender_shader_sockets]):
|
||||
return False
|
||||
elif filter_type == "NONE":
|
||||
# No check
|
||||
# No check
|
||||
pass
|
||||
|
||||
return True
|
||||
|
|
|
@ -251,7 +251,7 @@ def get_factor_from_socket(socket, kind):
|
|||
if kind == 'VALUE':
|
||||
if node.type == 'MATH' and node.operation == 'MULTIPLY':
|
||||
x1 = get_const_from_socket(node.inputs[0], kind)
|
||||
x2 = get_const_from_socket(node.inputs[1], kind)
|
||||
x2 = get_const_from_socket(node.inputs[1], kind)
|
||||
if x1 is not None and x2 is None: return x1
|
||||
if x2 is not None and x1 is None: return x2
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ from .gltf2_blender_image import TmpImageGuard, make_temp_image_copy
|
|||
def specular_calculation(stored):
|
||||
|
||||
# See https://gist.github.com/proog128/d627c692a6bbe584d66789a5a6437a33
|
||||
|
||||
|
||||
# Find all Blender images used
|
||||
images = []
|
||||
for fill in stored.values():
|
||||
|
@ -29,7 +29,7 @@ def specular_calculation(stored):
|
|||
|
||||
for identifier, image in [(ident, store.image) for (ident, store) in stored.items() if isinstance(store, StoreImage)]:
|
||||
tmp_buf = np.empty(width * height * 4, np.float32)
|
||||
|
||||
|
||||
if image.size[0] == width and image.size[1] == height:
|
||||
image.pixels.foreach_get(tmp_buf)
|
||||
else:
|
||||
|
@ -75,7 +75,7 @@ def specular_calculation(stored):
|
|||
# TODOExt Manage all 0
|
||||
return c / stack3(l)
|
||||
|
||||
|
||||
|
||||
f0_from_ior = ((ior - 1)/(ior + 1))**2
|
||||
tint_strength = (1 - stack3(buffers['specular_tint'])) + normalize(buffers['base_color']) * stack3(buffers['specular_tint'])
|
||||
out_buf = (1 - stack3(buffers['transmission'])) * (1 / f0_from_ior) * 0.08 * stack3(buffers['specular']) * tint_strength + stack3(buffers['transmission']) * tint_strength
|
||||
|
@ -90,5 +90,5 @@ def specular_calculation(stored):
|
|||
|
||||
out_buf = np.dstack((out_buf, np.ones((width, height)))) # Set alpha (glTF specular) to 1
|
||||
out_buf = np.reshape(out_buf, (width * height * 4))
|
||||
|
||||
|
||||
return np.float32(out_buf), width, height, [float(f) for f in factor] if factor else None
|
||||
|
|
|
@ -31,7 +31,7 @@ def sheen( mh,
|
|||
sheenRoughnessFactor = ext.get('sheenRoughnessFactor', 0.0)
|
||||
tex_info_roughness = ext.get('sheenRoughnessTexture')
|
||||
if tex_info_roughness is not None:
|
||||
tex_info_roughness = TextureInfo.from_dict(tex_info_roughness)
|
||||
tex_info_roughness = TextureInfo.from_dict(tex_info_roughness)
|
||||
|
||||
if tex_info_color is None:
|
||||
sheenColorFactor.extend([1.0])
|
||||
|
@ -86,4 +86,4 @@ def sheen( mh,
|
|||
color_socket=None,
|
||||
alpha_socket=sheenRoughness_socket
|
||||
)
|
||||
return
|
||||
return
|
||||
|
|
|
@ -9,9 +9,9 @@ from .gltf2_blender_image import BlenderImage
|
|||
from ..exp.gltf2_blender_image import TmpImageGuard, make_temp_image_copy
|
||||
|
||||
|
||||
def specular(mh, location_specular,
|
||||
location_specular_tint,
|
||||
specular_socket,
|
||||
def specular(mh, location_specular,
|
||||
location_specular_tint,
|
||||
specular_socket,
|
||||
specular_tint_socket,
|
||||
original_specular_socket,
|
||||
original_specularcolor_socket,
|
||||
|
@ -88,9 +88,9 @@ def specular(mh, location_specular,
|
|||
# Before creating converted textures,
|
||||
# Also plug non converted data into glTF PBR Non Converted Extensions node
|
||||
original_specular( mh,
|
||||
specular_factor,
|
||||
tex_specular_info,
|
||||
specular_color_factor,
|
||||
specular_factor,
|
||||
tex_specular_info,
|
||||
specular_color_factor,
|
||||
tex_specular_color_info,
|
||||
original_specular_socket,
|
||||
original_specularcolor_socket,
|
||||
|
@ -98,7 +98,7 @@ def specular(mh, location_specular,
|
|||
location_original_specularcolor
|
||||
)
|
||||
|
||||
|
||||
|
||||
if not use_texture:
|
||||
|
||||
def luminance(c):
|
||||
|
@ -165,14 +165,14 @@ def specular(mh, location_specular,
|
|||
specular_image_name: 'spec'
|
||||
}
|
||||
images = [(name, bpy.data.images[name]) for name in [base_color_image_name, transmission_image_name, specularcolor_image_name, specular_image_name] if name is not None]
|
||||
|
||||
|
||||
width = max(image[1].size[0] for image in images)
|
||||
height = max(image[1].size[1] for image in images)
|
||||
|
||||
buffers = {}
|
||||
for name, image in images:
|
||||
tmp_buf = np.empty(width * height * 4, np.float32)
|
||||
|
||||
|
||||
if image.size[0] == width and image.size[1] == height:
|
||||
image.pixels.foreach_get(tmp_buf)
|
||||
else:
|
||||
|
@ -265,7 +265,7 @@ def specular(mh, location_specular,
|
|||
color_socket=specular_socket,
|
||||
forced_image=blender_image_spec
|
||||
)
|
||||
|
||||
|
||||
if blender_specular_tint_tex_not_needed == True:
|
||||
lum = lambda c: 0.3 * c[0] + 0.6 * c[1] + 0.1 * c[2]
|
||||
specular_tint_socket.default_value = lum(blender_specular_tint[0][0])
|
||||
|
@ -275,7 +275,7 @@ def specular(mh, location_specular,
|
|||
blender_image_tint = bpy.data.images.new('Specular Tint', width, height)
|
||||
blender_image_tint.pixels.foreach_set(np.float32(blender_specular_tint))
|
||||
blender_image_tint.pack()
|
||||
|
||||
|
||||
# Create Textures in Blender
|
||||
tex_info = tex_specular_color_info
|
||||
if tex_info is None:
|
||||
|
@ -297,8 +297,8 @@ def specular(mh, location_specular,
|
|||
|
||||
def original_specular( mh,
|
||||
specular_factor,
|
||||
tex_specular_info,
|
||||
specular_color_factor,
|
||||
tex_specular_info,
|
||||
specular_color_factor,
|
||||
tex_specular_color_info,
|
||||
original_specular_socket,
|
||||
original_specularcolor_socket,
|
||||
|
@ -355,11 +355,11 @@ def original_specular( mh,
|
|||
original_specularcolor_socket = node.inputs[6]
|
||||
node.inputs[7].default_value = specular_color_factor
|
||||
x_specularcolor -= 200
|
||||
|
||||
|
||||
texture(
|
||||
mh,
|
||||
tex_info=tex_specular_color_info,
|
||||
label='SPECULAR COLOR',
|
||||
location=(x_specularcolor, y_specularcolor),
|
||||
color_socket=original_specularcolor_socket,
|
||||
)
|
||||
)
|
||||
|
|
|
@ -97,4 +97,3 @@ def _placeholder_image(name, path):
|
|||
image.filepath = path
|
||||
image.source = 'FILE'
|
||||
return image
|
||||
|
||||
|
|
|
@ -138,7 +138,7 @@ def do_primitives(gltf, mesh_idx, skin_idx, mesh, ob):
|
|||
for attr in attributes:
|
||||
attribute_data.append(
|
||||
np.empty(
|
||||
dtype=ComponentType.to_numpy_dtype(gltf.data.accessors[prim.attributes[attr]].component_type),
|
||||
dtype=ComponentType.to_numpy_dtype(gltf.data.accessors[prim.attributes[attr]].component_type),
|
||||
shape=(0, DataType.num_elements(gltf.data.accessors[prim.attributes[attr]].type)))
|
||||
)
|
||||
|
||||
|
@ -426,7 +426,7 @@ def do_primitives(gltf, mesh_idx, skin_idx, mesh, ob):
|
|||
|
||||
for mapping in prim.extensions['KHR_materials_variants']['mappings']:
|
||||
# Store, for each variant, the material link to this primitive
|
||||
|
||||
|
||||
variant_primitive = mesh.gltf2_variant_mesh_data.add()
|
||||
variant_primitive.material_slot_index = material_index
|
||||
if 'material' not in mapping.keys():
|
||||
|
|
|
@ -88,7 +88,7 @@ def pbr_metallic_roughness(mh: MaterialHelper):
|
|||
|
||||
|
||||
if mh.pymat.extensions and 'KHR_materials_sheen':
|
||||
pass #TOTOEXT
|
||||
pass #TOTOEXT
|
||||
|
||||
locs = calc_locations(mh)
|
||||
|
||||
|
|
|
@ -149,4 +149,4 @@ GLTF_DATA_TYPE_MAT2 = "MAT2"
|
|||
GLTF_DATA_TYPE_MAT3 = "MAT3"
|
||||
GLTF_DATA_TYPE_MAT4 = "MAT4"
|
||||
|
||||
GLTF_IOR = 1.5
|
||||
GLTF_IOR = 1.5
|
||||
|
|
|
@ -270,7 +270,7 @@ def export_meta(file, metas, tab_write, DEF_MAT_NAME):
|
|||
diffuse_color = material.diffuse_color
|
||||
trans = 1.0 - material.pov.alpha
|
||||
if material.pov.use_transparency and material.pov.transparency_method == 'RAYTRACE':
|
||||
pov_filter = material.pov_raytrace_transparency.filter * (1.0 -
|
||||
pov_filter = material.pov_raytrace_transparency.filter * (1.0 -
|
||||
material.pov.alpha)
|
||||
trans = (1.0 - material.pov.alpha) - pov_filter
|
||||
else:
|
||||
|
|
|
@ -12,7 +12,7 @@ from bpy.types import (
|
|||
Panel,
|
||||
UIList,
|
||||
)
|
||||
# Add space_view3d.py to module search path for VIEW3D_PT_object_type_visibility import.
|
||||
# Add space_view3d.py to module search path for VIEW3D_PT_object_type_visibility import.
|
||||
import os.path, sys
|
||||
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../../startup/bl_ui')))
|
||||
from space_view3d import VIEW3D_PT_object_type_visibility
|
||||
|
|
Loading…
Reference in New Issue