-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from mika-f/feature/major-upgrade
- Loading branch information
Showing
62 changed files
with
2,170 additions
and
637 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,6 +39,7 @@ body: | |
- 2.11.0 | ||
- 2.12.0 | ||
- 2.12.1 | ||
- 3.0.0-alpha.1 | ||
validations: | ||
required: true | ||
- type: dropdown | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"[python]": { | ||
"editor.defaultFormatter": "ms-python.black-formatter" | ||
}, | ||
"editor.formatOnSave": true, | ||
"black-formatter.args": ["--line-length=120"], | ||
"python.formatting.provider": "black" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# ------------------------------------------------------------------------------------------ | ||
# Copyright (c) Natsuneko. All rights reserved. | ||
# Licensed under the MIT License. See LICENSE in the project root for license information. | ||
# ------------------------------------------------------------------------------------------ | ||
|
||
# pyright: reportUnboundVariable=false | ||
# pyright: reportUnknownArgumentType=false | ||
|
||
bl_info = { | ||
"name": "Drag and Drop Support", | ||
"author": "Natsuneko", | ||
"description": "Blender add-on for import some files from drag-and-drop", | ||
"blender": (3, 1, 0), | ||
"version": (2, 13, 0), | ||
"location": "Drag and Drop Support", | ||
"doc_url": "https://docs.natsuneko.com/en-us/drag-and-drop-support/", | ||
"tracker_url": "https://github.com/mika-f/blender-drag-and-drop/issues", | ||
"category": "Import-Export", | ||
} | ||
|
||
|
||
if "bpy" in locals(): | ||
import importlib | ||
|
||
importlib.reload(formats) | ||
importlib.reload(interop) | ||
importlib.reload(operator) | ||
importlib.reload(preferences) | ||
else: | ||
from . import formats | ||
from . import interop | ||
from . import operator | ||
from . import preferences | ||
|
||
import bpy # nopep8 | ||
|
||
|
||
classes: list[type] = [operator.DropEventListener, preferences.DragAndDropPreferences] | ||
|
||
classes.extend(formats.CLASSES) | ||
|
||
|
||
def register(): | ||
global classes | ||
|
||
# register classes | ||
for c in classes: | ||
bpy.utils.register_class(c) | ||
|
||
interop.try_load() | ||
|
||
|
||
def unregister(): | ||
global classes | ||
|
||
# unregister classes | ||
for c in classes: | ||
bpy.utils.unregister_class(c) # pyright: ignore[reportUnknownMemberType] | ||
|
||
interop.try_unload() | ||
|
||
|
||
if __name__ == "__main__": | ||
register() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# ------------------------------------------------------------------------------------------ | ||
# Copyright (c) Natsuneko. All rights reserved. | ||
# Licensed under the MIT License. See LICENSE in the project root for license information. | ||
# ------------------------------------------------------------------------------------------ | ||
|
||
# pyright: reportUnusedImport=false | ||
|
||
from . import abc | ||
from . import bvh | ||
from . import dae | ||
from . import fbx | ||
from . import glb | ||
from . import obj | ||
from . import obj_legacy | ||
from . import ply | ||
from . import stl | ||
from . import stl_legacy | ||
from . import svg | ||
from . import usd | ||
from . import vrm | ||
from . import x3d | ||
|
||
CLASSES: list[type] = [] | ||
|
||
# legacy importers | ||
CLASSES.extend(obj_legacy.OPERATORS) | ||
CLASSES.extend(stl_legacy.OPERATORS) | ||
|
||
# modern importers | ||
CLASSES.extend(abc.OPERATORS) | ||
CLASSES.extend(bvh.OPERATORS) | ||
CLASSES.extend(dae.OPERATORS) | ||
CLASSES.extend(fbx.OPERATORS) | ||
CLASSES.extend(glb.OPERATORS) | ||
CLASSES.extend(obj.OPERATORS) | ||
CLASSES.extend(ply.OPERATORS) | ||
CLASSES.extend(stl.OPERATORS) | ||
CLASSES.extend(svg.OPERATORS) | ||
CLASSES.extend(usd.OPERATORS) | ||
CLASSES.extend(vrm.OPERATORS) | ||
CLASSES.extend(x3d.OPERATORS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
# ------------------------------------------------------------------------------------------ | ||
# Copyright (c) Natsuneko. All rights reserved. | ||
# Licensed under the MIT License. See LICENSE in the project root for license information. | ||
# ------------------------------------------------------------------------------------------ | ||
|
||
# pyright: reportGeneralTypeIssues=false | ||
# pyright: reportUnknownArgumentType=false | ||
# pyright: reportUnknownMemberType=false | ||
|
||
from typing import Set | ||
import bpy | ||
|
||
from bpy.props import ( | ||
BoolProperty, # pyright: ignore[reportUnknownVariableType] | ||
FloatProperty, # pyright: ignore[reportUnknownVariableType] | ||
) | ||
from bpy.types import Context | ||
|
||
from .super import ( | ||
ImportWithDefaultsBase, | ||
ImportsWithCustomSettingsBase, | ||
VIEW3D_MT_Space_Import_BASE, | ||
) | ||
|
||
|
||
class ImportABCWithDefaults(ImportWithDefaultsBase): | ||
bl_idname = "object.import_abc_with_defaults" | ||
bl_label = "Import ABC File" | ||
|
||
def execute(self, context: Context) -> Set[str] | Set[int]: | ||
bpy.ops.wm.alembic_import(filepath=self.filepath()) | ||
return {"FINISHED"} | ||
|
||
|
||
class ImportABCWithCustomSettings(ImportsWithCustomSettingsBase): | ||
bl_idname = "object.import_abc_with_custom_settings" | ||
bl_label = "Import ABC File" | ||
|
||
# Properties based on Blender v4.0.0 (ordered by parameters on documents) | ||
relative_path: BoolProperty(default=True, name="Relative Path") | ||
scale: FloatProperty(default=1.0, min=0.0001, max=1000, name="Scale") | ||
set_frame_range: BoolProperty(default=True, name="Set Frame Range") | ||
validate_meshes: BoolProperty(default=False, name="Validate Meshes") | ||
always_add_cache_reader: BoolProperty(default=False, name="Always Add Cache Reader") | ||
is_sequence: BoolProperty(default=False, name="Is Sequence") | ||
|
||
manual_transform_section: BoolProperty(default=True, name="Manual Transform") | ||
options_section: BoolProperty(default=True, name="Option") | ||
|
||
def draw(self, context: Context): | ||
# Manual Transform Section | ||
column, state = self.get_expand_column("manual_transform_section") | ||
|
||
if state: | ||
column.prop(self, "scale") | ||
|
||
# Options Section | ||
column, state = self.get_expand_column("options_section") | ||
|
||
if state: | ||
column.prop(self, "relative_path") | ||
column.prop(self, "set_frame_range") | ||
column.prop(self, "is_sequence") | ||
column.prop(self, "validate_meshes") | ||
column.prop(self, "always_add_cache_reader") | ||
|
||
def execute(self, context: Context) -> Set[str] | Set[int]: | ||
bpy.ops.wm.alembic_import( | ||
filepath=self.filepath(), | ||
relative_path=self.relative_path, | ||
scale=self.scale, | ||
set_frame_range=self.set_frame_range, | ||
validate_meshes=self.validate_meshes, | ||
always_add_cache_reader=self.always_add_cache_reader, | ||
is_sequence=self.is_sequence, | ||
) | ||
|
||
return {"FINISHED"} | ||
|
||
|
||
class VIEW3D_MT_Space_Import_ABC(VIEW3D_MT_Space_Import_BASE): | ||
bl_label = "Import ABC File" | ||
|
||
def format(self): | ||
return "abc" | ||
|
||
|
||
OPERATORS = [ | ||
ImportABCWithDefaults, | ||
ImportABCWithCustomSettings, | ||
VIEW3D_MT_Space_Import_ABC, | ||
] |
Oops, something went wrong.