3
11

io_scene_3ds: Update for Blender 3.x #2

Merged
Sebastian Sille merged 34 commits from blender-v3.5-release into blender-v3.1-release 2023-02-17 22:45:58 +01:00
37 changed files with 523 additions and 832 deletions

View File

@ -1,7 +0,0 @@
{
"project_id" : "Blender Addons Contrib",
"conduit_uri" : "https://developer.blender.org/",
"phabricator.uri" : "https://developer.blender.org/",
"git.default-relative-commit" : "origin/master",
"arc.land.update.default" : "rebase"
}

View File

@ -0,0 +1,5 @@
${CommitTitle}
${CommitBody}
Pull Request #${PullRequestIndex}

View File

@ -0,0 +1,3 @@
${PullRequestTitle}
Pull Request #${PullRequestIndex}

View File

@ -0,0 +1,19 @@
name: Pull Request
about: Contribute to add-ons bundled with Blender
body:
- type: markdown
attributes:
value: |
### Instructions
* [Contributing a new add-on](https://wiki.blender.org/wiki/Process/Addons)
* [Contributing code](https://wiki.blender.org/index.php/Dev:Doc/Process/Contributing_Code)
* [Effective code review](https://wiki.blender.org/index.php/Dev:Doc/Tools/Code_Review)
By submitting code here, you agree that the code is (compatible with) GNU GPL v2 or later.
- type: textarea
id: body
attributes:
label: "Description"
hide_label: true

View File

@ -1,5 +1,4 @@
This repository is only used as a mirror of git.blender.org. Blender development happens on This repository is only used as a mirror. Blender development happens on projects.blender.org.
https://developer.blender.org.
To get started with contributing code, please see: To get started with contributing code, please see:
https://wiki.blender.org/wiki/Process/Contributing_Code https://wiki.blender.org/wiki/Process/Contributing_Code

3
.github/stale.yml vendored
View File

@ -15,8 +15,7 @@ staleLabel: stale
# Comment to post when closing a stale Issue or Pull Request. # Comment to post when closing a stale Issue or Pull Request.
closeComment: > closeComment: >
This issue has been automatically closed, because this repository is only This issue has been automatically closed, because this repository is only
used as a mirror of git.blender.org. Blender development happens on used as a mirror. Blender development happens on projects.blender.org.
developer.blender.org.
To get started contributing code, please read: To get started contributing code, please read:
https://wiki.blender.org/wiki/Process/Contributing_Code https://wiki.blender.org/wiki/Process/Contributing_Code

View File

@ -16,8 +16,6 @@
# #
# ##### END GPL LICENSE BLOCK ##### # ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
bl_info = { bl_info = {
"name": "Motion Trail", "name": "Motion Trail",

View File

@ -16,8 +16,6 @@
# #
# ##### END GPL LICENSE BLOCK ##### # ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
bl_info = { bl_info = {
"name": "UI Classes Overview", "name": "UI Classes Overview",
"author": "lijenstina", "author": "lijenstina",

File diff suppressed because it is too large Load Diff

View File

@ -16,8 +16,6 @@
# #
# ##### END GPL LICENSE BLOCK ##### # ##### END GPL LICENSE BLOCK #####
# <pep8-80 compliant>
from bpy_extras.io_utils import ( from bpy_extras.io_utils import (
ImportHelper, ImportHelper,
ExportHelper, ExportHelper,
@ -34,8 +32,8 @@ import bpy
bl_info = { bl_info = {
"name": "Autodesk 3DS format", "name": "Autodesk 3DS format",
"author": "Bob Holcomb, Campbell Barton, Andreas Atteneder, Sebastian Schrand", "author": "Bob Holcomb, Campbell Barton, Andreas Atteneder, Sebastian Schrand",
"version": (2, 1, 0), "version": (2, 2, 0),
"blender": (2, 82, 0), "blender": (3, 0, 0),
"location": "File > Import", "location": "File > Import",
"description": "Import 3DS, meshes, uvs, materials, textures, " "description": "Import 3DS, meshes, uvs, materials, textures, "
"cameras & lamps", "cameras & lamps",

View File

@ -16,8 +16,6 @@
# #
# ##### END GPL LICENSE BLOCK ##### # ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
# Script copyright (C) Bob Holcomb # Script copyright (C) Bob Holcomb
# Contributors: Campbell Barton, Bob Holcomb, Richard Lärkäng, Damien McGinnes, Mark Stijnman, Sebastian Sille # Contributors: Campbell Barton, Bob Holcomb, Richard Lärkäng, Damien McGinnes, Mark Stijnman, Sebastian Sille
@ -647,8 +645,8 @@ def make_material_chunk(material, image):
name_str = material.name if material else "None" name_str = material.name if material else "None"
if image: #if image:
name_str += image.name # name_str += image.name
name.add_variable("name", _3ds_string(sane_name(name_str))) name.add_variable("name", _3ds_string(sane_name(name_str)))
material_chunk.add_subchunk(name) material_chunk.add_subchunk(name)
@ -672,6 +670,7 @@ def make_material_chunk(material, image):
material_chunk.add_subchunk(make_percent_subchunk(MATSHIN2, wrap.specular)) material_chunk.add_subchunk(make_percent_subchunk(MATSHIN2, wrap.specular))
material_chunk.add_subchunk(make_percent_subchunk(MATSHIN3, wrap.metallic)) material_chunk.add_subchunk(make_percent_subchunk(MATSHIN3, wrap.metallic))
material_chunk.add_subchunk(make_percent_subchunk(MATTRANS, 1 - wrap.alpha)) material_chunk.add_subchunk(make_percent_subchunk(MATTRANS, 1 - wrap.alpha))
material_chunk.add_subchunk(make_percent_subchunk(MATSELFILPCT, wrap.emission_strength))
material_chunk.add_subchunk(shading) material_chunk.add_subchunk(shading)
if wrap.base_color_texture: if wrap.base_color_texture:
@ -706,13 +705,10 @@ def make_material_chunk(material, image):
normal = [wrap.normalmap_texture] normal = [wrap.normalmap_texture]
bump = wrap.normalmap_strength bump = wrap.normalmap_strength
b_pct = min(bump, 1) b_pct = min(bump, 1)
bumpval = min(999, (bump * 100)) # 3ds max bump = 999
strength = _3ds_chunk(MAT_BUMP_PERCENT)
strength.add_variable("bump_pct", _3ds_ushort(int(bumpval)))
matmap = make_material_texture_chunk(MAT_BUMPMAP, normal, b_pct) matmap = make_material_texture_chunk(MAT_BUMPMAP, normal, b_pct)
if matmap: if matmap:
material_chunk.add_subchunk(matmap) material_chunk.add_subchunk(matmap)
material_chunk.add_subchunk(strength) material_chunk.add_subchunk(make_percent_subchunk(MAT_BUMP_PERCENT, b_pct))
if wrap.roughness_texture: if wrap.roughness_texture:
roughness = [wrap.roughness_texture] roughness = [wrap.roughness_texture]
@ -722,7 +718,7 @@ def make_material_chunk(material, image):
material_chunk.add_subchunk(matmap) material_chunk.add_subchunk(matmap)
if wrap.emission_color_texture: if wrap.emission_color_texture:
e_pct = sum(wrap.emission_color[:]) * .25 e_pct = wrap.emission_strength
emission = [wrap.emission_color_texture] emission = [wrap.emission_color_texture]
matmap = make_material_texture_chunk(MAT_SELFIMAP, emission, e_pct) matmap = make_material_texture_chunk(MAT_SELFIMAP, emission, e_pct)
if matmap: if matmap:
@ -909,8 +905,8 @@ def make_faces_chunk(tri_list, mesh, materialDict):
context_face_array = unique_mats[ma, img][1] context_face_array = unique_mats[ma, img][1]
except: except:
name_str = ma if ma else "None" name_str = ma if ma else "None"
if img: #if img:
name_str += img # name_str += img
context_face_array = _3ds_array() context_face_array = _3ds_array()
unique_mats[ma, img] = _3ds_string(sane_name(name_str)), context_face_array unique_mats[ma, img] = _3ds_string(sane_name(name_str)), context_face_array
@ -1171,7 +1167,7 @@ def save(operator,
): ):
import time import time
from bpy_extras.io_utils import create_derived_objects, free_derived_objects #from bpy_extras.io_utils import create_derived_objects, free_derived_objects
"""Save the Blender scene to a 3ds file.""" """Save the Blender scene to a 3ds file."""
@ -1187,7 +1183,7 @@ def save(operator,
scene = context.scene scene = context.scene
layer = context.view_layer layer = context.view_layer
#depsgraph = context.evaluated_depsgraph_get() depsgraph = context.evaluated_depsgraph_get()
# Initialize the main chunk (primary): # Initialize the main chunk (primary):
primary = _3ds_chunk(PRIMARY) primary = _3ds_chunk(PRIMARY)
@ -1235,7 +1231,9 @@ def save(operator,
for ob in objects: for ob in objects:
# get derived objects # get derived objects
free, derived = create_derived_objects(scene, ob) #free, derived = create_derived_objects(scene, ob)
derived_dict = bpy_extras.io_utils.create_derived_objects(depsgraph, [ob])
derived = derived_dict.get(ob)
if derived is None: if derived is None:
continue continue
@ -1244,7 +1242,6 @@ def save(operator,
if ob.type not in {'MESH', 'CURVE', 'SURFACE', 'FONT', 'META'}: if ob.type not in {'MESH', 'CURVE', 'SURFACE', 'FONT', 'META'}:
continue continue
#ob_derived_eval = ob_derived.evaluated_get(depsgraph)
try: try:
data = ob_derived.to_mesh() data = ob_derived.to_mesh()
except: except:
@ -1288,8 +1285,8 @@ def save(operator,
# ob_derived_eval.to_mesh_clear() # ob_derived_eval.to_mesh_clear()
if free: #if free:
free_derived_objects(ob) # free_derived_objects(ob)
# Make material chunks for all materials used in the meshes: # Make material chunks for all materials used in the meshes:
for ma_image in materialDict.values(): for ma_image in materialDict.values():

View File

@ -16,8 +16,6 @@
# #
# ##### END GPL LICENSE BLOCK ##### # ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
# Script copyright (C) Bob Holcomb # Script copyright (C) Bob Holcomb
# Contributors: Bob Holcomb, Richard L?rk?ng, Damien McGinnes, Sebastian Sille # Contributors: Bob Holcomb, Richard L?rk?ng, Damien McGinnes, Sebastian Sille
# Campbell Barton, Mario Lapin, Dominique Lorre, Andreas Atteneder # Campbell Barton, Mario Lapin, Dominique Lorre, Andreas Atteneder
@ -65,6 +63,7 @@ MAT_SHIN2 = 0xA041 # Shininess of the object/material (percent)
MAT_SHIN3 = 0xA042 # Reflection of the object/material (percent) MAT_SHIN3 = 0xA042 # Reflection of the object/material (percent)
MAT_TRANSPARENCY = 0xA050 # Transparency value of material (percent) MAT_TRANSPARENCY = 0xA050 # Transparency value of material (percent)
MAT_SELF_ILLUM = 0xA080 # Self Illumination value of material MAT_SELF_ILLUM = 0xA080 # Self Illumination value of material
MATSELFILPCT = 0xA084 # Self illumination strength (percent)
MAT_WIRE = 0xA085 # Only render's wireframe MAT_WIRE = 0xA085 # Only render's wireframe
MAT_TEXTURE_MAP = 0xA200 # This is a header for a new texture map MAT_TEXTURE_MAP = 0xA200 # This is a header for a new texture map
@ -467,6 +466,7 @@ def process_next_chunk(context, file, previous_chunk, imported_objects, IMAGE_SE
pct = 50 pct = 50
contextWrapper.emission_color = contextMaterial.line_color[:3] contextWrapper.emission_color = contextMaterial.line_color[:3]
contextWrapper.emission_strength = contextMaterial.line_priority / 100
contextWrapper.base_color = contextMaterial.diffuse_color[:3] contextWrapper.base_color = contextMaterial.diffuse_color[:3]
contextWrapper.specular = contextMaterial.specular_intensity contextWrapper.specular = contextMaterial.specular_intensity
contextWrapper.roughness = contextMaterial.roughness contextWrapper.roughness = contextMaterial.roughness
@ -669,6 +669,18 @@ def process_next_chunk(context, file, previous_chunk, imported_objects, IMAGE_SE
print("Cannot read material transparency") print("Cannot read material transparency")
new_chunk.bytes_read += temp_chunk.bytes_read new_chunk.bytes_read += temp_chunk.bytes_read
elif new_chunk.ID == MATSELFILPCT:
read_chunk(file, temp_chunk)
if temp_chunk.ID == PERCENTAGE_SHORT:
temp_data = file.read(SZ_U_SHORT)
temp_chunk.bytes_read += SZ_U_SHORT
contextMaterial.line_priority = int(struct.unpack('H', temp_data)[0])
elif temp_chunk.ID == PERCENTAGE_FLOAT:
temp_data = file.read(SZ_FLOAT)
temp_chunk.bytes_read += SZ_FLOAT
contextMaterial.line_priority = (float(struct.unpack('f', temp_data)[0]) * 100)
new_chunk.bytes_read += temp_chunk.bytes_read
elif new_chunk.ID == MAT_TEXTURE_MAP: elif new_chunk.ID == MAT_TEXTURE_MAP:
read_texture(new_chunk, temp_chunk, "Diffuse", "COLOR") read_texture(new_chunk, temp_chunk, "Diffuse", "COLOR")
@ -686,11 +698,18 @@ def process_next_chunk(context, file, previous_chunk, imported_objects, IMAGE_SE
read_texture(new_chunk, temp_chunk, "Bump", "NORMAL") read_texture(new_chunk, temp_chunk, "Bump", "NORMAL")
elif new_chunk.ID == MAT_BUMP_PERCENT: elif new_chunk.ID == MAT_BUMP_PERCENT:
temp_data = file.read(SZ_U_SHORT) read_chunk(file, temp_chunk)
new_chunk.bytes_read += SZ_U_SHORT if temp_chunk.ID == PERCENTAGE_SHORT:
contextWrapper.normalmap_strength = (float(struct.unpack('<H', temp_data)[0]) / 100) temp_data = file.read(SZ_U_SHORT)
temp_chunk.bytes_read += SZ_U_SHORT
contextWrapper.normalmap_strength = (float(struct.unpack('<H', temp_data)[0]) / 100)
elif temp_chunk.ID == PERCENTAGE_FLOAT:
temp_data = file.read(SZ_FLOAT)
temp_chunk.bytes_read += SZ_FLOAT
contextWrapper.normalmap_strength = float(struct.unpack('f', temp_data)[0])
new_chunk.bytes_read += temp_chunk.bytes_read new_chunk.bytes_read += temp_chunk.bytes_read
elif new_chunk.ID == MAT_SHIN_MAP: elif new_chunk.ID == MAT_SHIN_MAP:
read_texture(new_chunk, temp_chunk, "Shininess", "ROUGHNESS") read_texture(new_chunk, temp_chunk, "Shininess", "ROUGHNESS")

View File

@ -16,8 +16,6 @@
# #
# ***** END GPL LICENCE BLOCK ***** # ***** END GPL LICENCE BLOCK *****
# <pep8 compliant>
bl_info = { bl_info = {
"name": "Open Street Map (.osm)", "name": "Open Street Map (.osm)",
"author": "Michael Anthrax Schlachter, ideasman42, littleneo", "author": "Michael Anthrax Schlachter, ideasman42, littleneo",

View File

@ -16,8 +16,6 @@
# #
# ##### END GPL LICENSE BLOCK ##### # ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
bl_info = { bl_info = {
"name": "Adobe Illustrator / PDF / SVG", "name": "Adobe Illustrator / PDF / SVG",
"author": "Howard Trickey", "author": "Howard Trickey",

View File

@ -16,8 +16,6 @@
# #
# ##### END GPL LICENSE BLOCK ##### # ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
"""Convert an Art object to a list of PolyArea objects. """Convert an Art object to a list of PolyArea objects.
""" """

View File

@ -16,8 +16,6 @@
# #
# ##### END GPL LICENSE BLOCK ##### # ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
"""Geometry classes and operations. """Geometry classes and operations.
Also, vector file representation (Art). Also, vector file representation (Art).
""" """

View File

@ -16,8 +16,6 @@
# #
# ##### END GPL LICENSE BLOCK ##### # ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
"""Importing a vector file into Model format. """Importing a vector file into Model format.
""" """

View File

@ -16,8 +16,6 @@
# #
# ##### END GPL LICENSE BLOCK ##### # ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
"""Manipulations of Models. """Manipulations of Models.
""" """

View File

@ -16,8 +16,6 @@
# #
# ##### END GPL LICENSE BLOCK ##### # ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
"""Creating offset polygons inside faces.""" """Creating offset polygons inside faces."""
__author__ = "howard.trickey@gmail.com" __author__ = "howard.trickey@gmail.com"

View File

@ -16,8 +16,6 @@
# #
# ##### END GPL LICENSE BLOCK ##### # ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
"""Functions for dealing with PDF files. """Functions for dealing with PDF files.
""" """

View File

@ -16,8 +16,6 @@
# #
# ##### END GPL LICENSE BLOCK ##### # ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
"""Reading SVG file format. """Reading SVG file format.
""" """

View File

@ -16,8 +16,6 @@
# #
# ##### END GPL LICENSE BLOCK ##### # ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
from . import geom from . import geom
import math import math

View File

@ -16,8 +16,6 @@
# #
# ##### END GPL LICENSE BLOCK ##### # ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
"""Reading various vector file formats. """Reading various vector file formats.
Functions for classifying files, tokenizing, and parsing them. Functions for classifying files, tokenizing, and parsing them.

View File

@ -17,8 +17,6 @@
# #
# ***** END GPL LICENCE BLOCK ***** # ***** END GPL LICENCE BLOCK *****
# <pep8 compliant> (Thanks to CodemanX on IRC)
bl_info = { bl_info = {
"name": "Show Vertex Groups/Weights", "name": "Show Vertex Groups/Weights",
"author": "Jason van Gumster (Fweeb), Bartius Crouch, CoDEmanX", "author": "Jason van Gumster (Fweeb), Bartius Crouch, CoDEmanX",

View File

@ -16,8 +16,6 @@
# #
# ##### END GPL LICENSE BLOCK ##### # ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
bl_info = { bl_info = {
"name": "Motion Capture Tools", "name": "Motion Capture Tools",
"author": "Benjy Cook", "author": "Benjy Cook",

View File

@ -16,8 +16,6 @@
# #
# ##### END GPL LICENSE BLOCK ##### # ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
import bpy import bpy
from mathutils import Vector from mathutils import Vector
from bpy_extras import anim_utils from bpy_extras import anim_utils

View File

@ -16,8 +16,6 @@
# #
# ##### END GPL LICENSE BLOCK ##### # ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
from math import sqrt, radians, floor, ceil from math import sqrt, radians, floor, ceil
import bpy import bpy
import time import time

View File

@ -16,8 +16,6 @@
# #
# ##### END GPL LICENSE BLOCK ##### # ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
import bpy import bpy
from mathutils import Vector, Matrix from mathutils import Vector, Matrix
from math import radians from math import radians

View File

@ -16,8 +16,6 @@
# #
# ##### END GPL LICENSE BLOCK ##### # ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
bl_info = { bl_info = {
"name": "Auto Face Map Widgets", "name": "Auto Face Map Widgets",
"author": "Campbell Barton", "author": "Campbell Barton",

View File

@ -16,8 +16,6 @@
# #
# ##### END GPL LICENSE BLOCK ##### # ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
import bpy import bpy
from bpy.types import ( from bpy.types import (
Operator, Operator,

View File

@ -16,8 +16,6 @@
# #
# ##### END GPL LICENSE BLOCK ##### # ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
# Use so we can develop modules without reloading the add-on. # Use so we can develop modules without reloading the add-on.

View File

@ -16,8 +16,6 @@
# #
# ##### END GPL LICENSE BLOCK ##### # ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
''' '''
Face map manipulator: Face map manipulator:

View File

@ -16,8 +16,6 @@
# #
# ##### END GPL LICENSE BLOCK ##### # ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
import bpy import bpy
import math import math

View File

@ -16,8 +16,6 @@
# #
# ##### END GPL LICENSE BLOCK ##### # ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
# Script copyright (C) Blender Foundation 2012 # Script copyright (C) Blender Foundation 2012

View File

@ -16,8 +16,6 @@
# #
# ======================= END GPL LICENSE BLOCK ======================== # ======================= END GPL LICENSE BLOCK ========================
# <pep8 compliant>
# ######################################## # ########################################
# Render Cube Map # Render Cube Map
# #

View File

@ -16,8 +16,6 @@
# #
# ##### END GPL LICENSE BLOCK ##### # ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
bl_info = { bl_info = {
"name": "Render to Print", "name": "Render to Print",
"author": "Marco Crippa <thekrypt77@tiscali.it>, Dealga McArdle, zebus3d", "author": "Marco Crippa <thekrypt77@tiscali.it>, Dealga McArdle, zebus3d",

View File

@ -16,8 +16,6 @@
# #
# ##### END GPL LICENSE BLOCK ##### # ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
# this script creates Keyboard layout images of the current keyboard configuration. # this script creates Keyboard layout images of the current keyboard configuration.
# first implementation done by jbakker # first implementation done by jbakker
# version 0.2 - file manager directory on export, modified the SVG layout (lijenstina) # version 0.2 - file manager directory on export, modified the SVG layout (lijenstina)