Compare commits
12 Commits
main
...
uv-refacto
Author | SHA1 | Date |
---|---|---|
Sofus Albert Høgsbro Rose | b921c3b5cd | |
Sofus Albert Høgsbro Rose | 0d5c9b78f7 | |
Sofus Albert Høgsbro Rose | fdcd52e937 | |
Sofus Albert Høgsbro Rose | 06ad0d62a5 | |
Sofus Albert Høgsbro Rose | 383f7d9bfd | |
Sofus Albert Høgsbro Rose | 55235c7032 | |
Sofus Albert Høgsbro Rose | 12362b3cbd | |
Sofus Albert Høgsbro Rose | 606d336683 | |
Sofus Albert Høgsbro Rose | 514b49160e | |
Sofus Albert Høgsbro Rose | ad548b8f03 | |
Sofus Albert Høgsbro Rose | e6ada5028d | |
Sofus Albert Høgsbro Rose | bac330ab2f |
|
@ -20,17 +20,27 @@ repos:
|
||||||
|
|
||||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||||
# Ruff version.
|
# Ruff version.
|
||||||
rev: v0.4.3
|
rev: v0.6.8
|
||||||
hooks:
|
hooks:
|
||||||
# ruff lint
|
# ruff lint
|
||||||
#- id: ruff
|
#- id: ruff
|
||||||
# args: [ --fix ]
|
#args: [ --fix ]
|
||||||
# ruff fmt
|
# ruff fmt
|
||||||
- id: ruff-format
|
- id: ruff-format
|
||||||
|
|
||||||
- repo: https://github.com/commitizen-tools/commitizen
|
- repo: https://github.com/commitizen-tools/commitizen
|
||||||
rev: master
|
rev: v3.29.1
|
||||||
hooks:
|
hooks:
|
||||||
- id: commitizen
|
- id: commitizen
|
||||||
- id: commitizen-branch
|
- id: commitizen-branch
|
||||||
stages: [push]
|
stages: [push]
|
||||||
|
|
||||||
|
- repo: local
|
||||||
|
hooks:
|
||||||
|
- id: pytest
|
||||||
|
name: pytest
|
||||||
|
entry: ./.venv/bin/pytest tests
|
||||||
|
language: system
|
||||||
|
types: [python]
|
||||||
|
pass_filenames: false
|
||||||
|
always_run: true
|
||||||
|
|
52
FUTURE.md
52
FUTURE.md
|
@ -1,52 +0,0 @@
|
||||||
# Projects / Plugins
|
|
||||||
## Larger Architectural Changes
|
|
||||||
[ ] Dedicated way of generating properties for sockets and nodes, incl. helping make better (less boilerplatey) use of callbacks
|
|
||||||
- Perhaps, we should also go 100% custom `PropertyGroup`, to the point that we have `nodes`, `sockets` and `props`.
|
|
||||||
- This would allow far simplified sockets (the more complex kinds), and help standardize use of ex. units in node properties.
|
|
||||||
- Having a dedicated base class for custom props would help avoid issues like forgetting to run `self.sync_prop` on every goddamn update method in every goddamn socket.
|
|
||||||
[ ] Dedicated way of handling node-specific operators without all the boilerplate.
|
|
||||||
|
|
||||||
## Field Data
|
|
||||||
[ ] Directly dealing with field data, instead of having field manipulations be baked into viz node(s).
|
|
||||||
[ ] Yee Cell Data as Attributes on By-Cell Point Cloud w/GeoNodes Integrations
|
|
||||||
- In effect, when we have xarray data defined based on Yee Cells ex. Poynting vector coordinates, let's import this to Blender as a simple point cloud centered at each cell and grant each an attribute corresponding to the data.
|
|
||||||
- What we can then do is use vanilla GeoNodes to ex. read the vector attribute, and draw small arrow meshes (maybe resampled which auto-interpolates the field values) from each point, thus effectively visualizing . vector fields and many other fun things.
|
|
||||||
- Of course, this is no good for volume cell data - but we can just overlay the raw volume cell data as we please. We can also, if we're sneaky, deal with our volume data as points as far as we can, and then finally do a "points to volume" type deal to make it sufficiently "fluffy/cloudy".
|
|
||||||
- I wonder if we could use the Attribute node in the shader editor to project interpolated values from points, onto a ex. plane mesh, in a way that would also be visualizable in the viewport.
|
|
||||||
|
|
||||||
## Tidy3D Features
|
|
||||||
[ ] Symmetry for Performance
|
|
||||||
- [ ] Implement <https://docs.flexcompute.com/projects/tidy3d/en/latest/notebooks/Symmetry.html>
|
|
||||||
[ ] Dispersive Model Fitting
|
|
||||||
[ ] Scattering Matrix Calculator
|
|
||||||
[ ] Resonance Finder
|
|
||||||
[ ] Adjoint Optimization
|
|
||||||
[ ] Design Space Exploration / Parameterization
|
|
||||||
|
|
||||||
## Preview Semantics
|
|
||||||
[ ] Node tree header toggle that toggles a modal operator on and off, which constantly checks the context of the selected nodes, and tries to `bl_select` them (which in turn, should cause the node base class to `bl_select` shit inside).
|
|
||||||
- Shouldn't survive a file save; always startup with this thing off.
|
|
||||||
[ ] Custom gizmos attached to preview toggles!
|
|
||||||
- There is a WIP for GN-driven gizmos: <https://projects.blender.org/blender/blender/pulls/112677>
|
|
||||||
- Probably best to wait for that, then just add gizmos to existing driven GN trees, as opposed to unholy OGL spaghetti.
|
|
||||||
[ ] Node-ManagedObj Selection binding
|
|
||||||
- BL to Node:
|
|
||||||
- Trigger: The post-depsgraph handler seems appropriate.
|
|
||||||
- Input: Read the object location (origin), using a unit system.
|
|
||||||
- Output: Write the input socket value.
|
|
||||||
- Condition: Input socket is unlinked. (If it's linked, then lock the object's position. Use sync_link_added() for that)
|
|
||||||
- Node to BL:
|
|
||||||
- Trigger: "Report" event on an input socket that the managed object declares reliance on.
|
|
||||||
- Input: The input socket value (linked or unlinked)
|
|
||||||
- Output: The object location (origin), using a unit system.
|
|
||||||
|
|
||||||
## Parametric Geometry UX
|
|
||||||
[ ] Consider allowing a mesh attribute (set in ex. geometry node) to specify the name of a medium.
|
|
||||||
- This allows assembling complex multi-medium structures in one geonodes tree.
|
|
||||||
- This should result in the spawning of several Medium input sockets in the GeoNodes structure node, named as the attributes are.
|
|
||||||
- The GeoNodes structure node should then output as array-like TriMeshes, for which mediums are correctly defined.
|
|
||||||
|
|
||||||
## Alternative Engines
|
|
||||||
[ ] Heat Solver
|
|
||||||
[ ] MEEP integration (<https://meep.readthedocs.io/en/latest/>)
|
|
||||||
- The main boost would be if we could setup a MEEP simulation entirely from a td.Simulation object.
|
|
|
@ -1,5 +1,5 @@
|
||||||
blender_maxwell
|
oscillode
|
||||||
Copyright (C) 2024 blender_maxwell Project Contributors
|
Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU Affero General Public License as published by
|
it under the terms of the GNU Affero General Public License as published by
|
||||||
|
|
|
@ -0,0 +1,101 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
"""A visual DSL for electromagnetic simulation design and analysis implemented as a Blender node editor."""
|
||||||
|
|
||||||
|
from functools import reduce
|
||||||
|
|
||||||
|
from . import contracts as ct
|
||||||
|
|
||||||
|
# from . import node_trees
|
||||||
|
from . import operators, preferences, registration
|
||||||
|
from .utils import logger
|
||||||
|
|
||||||
|
log = logger.get(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
####################
|
||||||
|
# - Load and Register Addon
|
||||||
|
####################
|
||||||
|
BL_REGISTER: list[ct.BLClass] = [
|
||||||
|
*operators.BL_REGISTER,
|
||||||
|
# *node_trees.BL_REGISTER,
|
||||||
|
]
|
||||||
|
|
||||||
|
BL_HANDLERS: ct.BLHandlers = reduce(
|
||||||
|
lambda a, b: a + b,
|
||||||
|
[
|
||||||
|
operators.BL_HANDLERS,
|
||||||
|
# node_trees.BL_HANDLERS,
|
||||||
|
],
|
||||||
|
ct.BLHandlers(),
|
||||||
|
)
|
||||||
|
|
||||||
|
BL_KEYMAP_ITEMS: list[ct.BLKeymapItem] = [
|
||||||
|
*operators.BL_KEYMAP_ITEMS,
|
||||||
|
# node_trees.BL_KEYMAP_ITEMS,
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
####################
|
||||||
|
# - Registration
|
||||||
|
####################
|
||||||
|
def register() -> None:
|
||||||
|
"""Implements addon registration in a way that respects the availability of addon preferences and loggers.
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
Called by Blender when enabling the addon.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
RuntimeError: If addon preferences fail to register.
|
||||||
|
"""
|
||||||
|
log.info('Registering Addon Preferences: %s', ct.addon.NAME)
|
||||||
|
registration.register_classes(preferences.BL_REGISTER)
|
||||||
|
|
||||||
|
addon_prefs = ct.addon.prefs()
|
||||||
|
if addon_prefs is not None:
|
||||||
|
# Update Loggers
|
||||||
|
# - This updates existing loggers to use settings defined by preferences.
|
||||||
|
addon_prefs.on_addon_logging_changed()
|
||||||
|
|
||||||
|
log.info('Registering Addon: %s', ct.addon.NAME)
|
||||||
|
|
||||||
|
registration.register_classes(BL_REGISTER)
|
||||||
|
registration.register_handlers(BL_HANDLERS)
|
||||||
|
registration.register_keymaps(BL_KEYMAP_ITEMS)
|
||||||
|
|
||||||
|
log.info('Finished Registration of Addon: %s', ct.addon.NAME)
|
||||||
|
else:
|
||||||
|
msg = 'Addon preferences did not register for addon {ct.addon.NAME} - something is very wrong!'
|
||||||
|
raise RuntimeError(msg)
|
||||||
|
|
||||||
|
|
||||||
|
def unregister() -> None:
|
||||||
|
"""Unregisters anything that was registered by the addon.
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
Run by Blender when disabling and/or uninstalling the addon.
|
||||||
|
|
||||||
|
This doesn't clean `sys.modules`.
|
||||||
|
We rely on the hope that Blender has extension-extension module isolation.
|
||||||
|
"""
|
||||||
|
log.info('Starting %s Unregister', ct.addon.NAME)
|
||||||
|
|
||||||
|
registration.unregister_keymaps()
|
||||||
|
registration.unregister_handlers()
|
||||||
|
registration.unregister_classes()
|
||||||
|
|
||||||
|
log.info('Finished %s Unregister', ct.addon.NAME)
|
Binary file not shown.
Binary file not shown.
|
@ -1,5 +1,5 @@
|
||||||
# blender_maxwell
|
# oscillode
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU Affero General Public License as published by
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -14,30 +14,38 @@
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
"""Independent constants and types, which represent a kind of 'social contract' governing communication between all components of the addon."""
|
||||||
|
|
||||||
from . import addon
|
from . import addon
|
||||||
from .bl import (
|
from .bl import (
|
||||||
BLClass,
|
BLClass,
|
||||||
BLColorRGBA,
|
BLColorRGBA,
|
||||||
BLEnumElement,
|
BLEnumElement,
|
||||||
BLEnumID,
|
BLEnumID,
|
||||||
|
BLEventType,
|
||||||
|
BLEventValue,
|
||||||
BLIcon,
|
BLIcon,
|
||||||
BLIconSet,
|
BLIconSet,
|
||||||
BLIDStruct,
|
BLIDStruct,
|
||||||
BLImportMethod,
|
BLImportMethod,
|
||||||
BLKeymapItem,
|
|
||||||
BLModifierType,
|
BLModifierType,
|
||||||
BLNodeTreeInterfaceID,
|
BLNodeTreeInterfaceID,
|
||||||
BLOperatorStatus,
|
BLOperatorStatus,
|
||||||
BLPropFlag,
|
BLPropFlag,
|
||||||
BLRegionType,
|
BLRegionType,
|
||||||
BLSpaceType,
|
BLSpaceType,
|
||||||
KeymapItemDef,
|
|
||||||
ManagedObjName,
|
ManagedObjName,
|
||||||
PresetName,
|
PresetName,
|
||||||
PropName,
|
PropName,
|
||||||
SocketName,
|
SocketName,
|
||||||
)
|
)
|
||||||
from .bl_types import BLEnumStrEnum
|
from .bl_handlers import BLHandlers
|
||||||
|
from .bl_keymap import BLKeymapItem
|
||||||
|
from .icons import Icon
|
||||||
|
from .mobj_types import ManagedObjType
|
||||||
|
from .node_tree_types import (
|
||||||
|
NodeTreeType,
|
||||||
|
)
|
||||||
from .operator_types import (
|
from .operator_types import (
|
||||||
OperatorType,
|
OperatorType,
|
||||||
)
|
)
|
||||||
|
@ -51,6 +59,8 @@ __all__ = [
|
||||||
'BLColorRGBA',
|
'BLColorRGBA',
|
||||||
'BLEnumElement',
|
'BLEnumElement',
|
||||||
'BLEnumID',
|
'BLEnumID',
|
||||||
|
'BLEventType',
|
||||||
|
'BLEventValue',
|
||||||
'BLIcon',
|
'BLIcon',
|
||||||
'BLIconSet',
|
'BLIconSet',
|
||||||
'BLIDStruct',
|
'BLIDStruct',
|
||||||
|
@ -64,12 +74,15 @@ __all__ = [
|
||||||
'BLSpaceType',
|
'BLSpaceType',
|
||||||
'KeymapItemDef',
|
'KeymapItemDef',
|
||||||
'ManagedObjName',
|
'ManagedObjName',
|
||||||
|
'ManagedObjType',
|
||||||
'PresetName',
|
'PresetName',
|
||||||
'PropName',
|
'PropName',
|
||||||
'SocketName',
|
'SocketName',
|
||||||
'BLEnumStrEnum',
|
'BLHandlers',
|
||||||
|
'Icon',
|
||||||
'BLInstance',
|
'BLInstance',
|
||||||
'InstanceID',
|
'InstanceID',
|
||||||
|
'NodeTreeType',
|
||||||
'OperatorType',
|
'OperatorType',
|
||||||
'PanelType',
|
'PanelType',
|
||||||
]
|
]
|
|
@ -0,0 +1,102 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
"""Basic 'single-source-of-truth' static and dynamic information about this addon.
|
||||||
|
|
||||||
|
Information is mined both from `bpy`, and from the addon's bundled manifest file.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
import tomllib
|
||||||
|
import typing as typ
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
import bpy
|
||||||
|
|
||||||
|
PATH_ADDON_ROOT = Path(__file__).resolve().parent.parent
|
||||||
|
PATH_MANIFEST = PATH_ADDON_ROOT / 'blender_manifest.toml'
|
||||||
|
|
||||||
|
with PATH_MANIFEST.open('rb') as f:
|
||||||
|
MANIFEST = tomllib.load(f)
|
||||||
|
|
||||||
|
NAME: str = MANIFEST['id']
|
||||||
|
VERSION: str = MANIFEST['version']
|
||||||
|
|
||||||
|
####################
|
||||||
|
# - Assets
|
||||||
|
####################
|
||||||
|
PATH_ASSETS: Path = PATH_ADDON_ROOT / 'assets'
|
||||||
|
|
||||||
|
if 'RUNNING_BLEXT_TESTS' in os.environ:
|
||||||
|
PATH_CACHE: Path = (
|
||||||
|
PATH_ADDON_ROOT.parent / 'dev' / 'local'
|
||||||
|
) ## TODO: Consult init_settings
|
||||||
|
else:
|
||||||
|
PATH_CACHE: Path = Path(bpy.utils.extension_path_user(__package__, create=True)) # type: ignore[no-redef]
|
||||||
|
|
||||||
|
|
||||||
|
####################
|
||||||
|
# - Dynamic Addon Information
|
||||||
|
####################
|
||||||
|
def operator(
|
||||||
|
name: str, *operator_args: list[typ.Any], **operator_kwargs: dict[str, typ.Any]
|
||||||
|
) -> None:
|
||||||
|
"""Convenienve method to call an operator from this addon.
|
||||||
|
|
||||||
|
This avoids having to use `bpy.ops.<addon_name>.operator_name`, which isn't generic.
|
||||||
|
|
||||||
|
Only operators from this addon may be called using this method.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
ValueError: If an addon from outside this operator is attempted to be used.
|
||||||
|
"""
|
||||||
|
# Parse Operator Name
|
||||||
|
operator_namespace, operator_name = name.split('.')
|
||||||
|
if operator_namespace != NAME:
|
||||||
|
msg = f'Tried to call operator {operator_name}, but addon operators may only use the addon operator namespace "{operator_namespace}.<name>"'
|
||||||
|
raise ValueError(msg)
|
||||||
|
|
||||||
|
# Run Operator
|
||||||
|
bl_operator = getattr(getattr(bpy.ops, NAME), operator_name)
|
||||||
|
bl_operator(*operator_args, **operator_kwargs)
|
||||||
|
## TODO: Can't we constrain 'name' to be an OperatorType somehow?
|
||||||
|
|
||||||
|
|
||||||
|
def prefs() -> bpy.types.AddonPreferences | None:
|
||||||
|
"""Retrieve the preferences of this addon, if they are available yet.
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
While registering the addon, one may wish to use the addon preferences.
|
||||||
|
This isn't possible - not even for default values.
|
||||||
|
|
||||||
|
Either a bad idea is at work, or `oscillode.utils.init_settings` should be consulted until the preferences are available.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
The addon preferences, if the addon is registered and loaded - otherwise None.
|
||||||
|
"""
|
||||||
|
addon = bpy.context.preferences.addons.get(NAME)
|
||||||
|
if addon is None:
|
||||||
|
return None
|
||||||
|
return addon.preferences
|
||||||
|
|
||||||
|
|
||||||
|
####################
|
||||||
|
# - Logging Info
|
||||||
|
####################
|
||||||
|
DEFAULT_LOG_PATH = PATH_ADDON_ROOT / 'addon.log'
|
||||||
|
## By default, the addon file log writes to the addon dir.
|
||||||
|
## The initial .log_level contents are written when packing the .zip.
|
||||||
|
## Subsequent changes are managed by nodeps.utils.simple_logger.py.
|
|
@ -1,5 +1,5 @@
|
||||||
# blender_maxwell
|
# oscillode
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU Affero General Public License as published by
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -14,6 +14,8 @@
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
"""Explicit type annotations for Blender objects, making it easier to guarantee correctness in communications with Blender."""
|
||||||
|
|
||||||
import typing as typ
|
import typing as typ
|
||||||
|
|
||||||
import bpy
|
import bpy
|
||||||
|
@ -93,7 +95,6 @@ BLIDStruct: typ.TypeAlias = (
|
||||||
| bpy.types.WorkSpace
|
| bpy.types.WorkSpace
|
||||||
| bpy.types.World
|
| bpy.types.World
|
||||||
)
|
)
|
||||||
BLKeymapItem: typ.TypeAlias = typ.Any ## TODO: Better Type
|
|
||||||
BLPropFlag: typ.TypeAlias = typ.Literal[
|
BLPropFlag: typ.TypeAlias = typ.Literal[
|
||||||
'HIDDEN',
|
'HIDDEN',
|
||||||
'SKIP_SAVE',
|
'SKIP_SAVE',
|
||||||
|
@ -110,6 +111,24 @@ BLColorRGBA = tuple[float, float, float, float]
|
||||||
####################
|
####################
|
||||||
# - Operators
|
# - Operators
|
||||||
####################
|
####################
|
||||||
|
BLRegionType: typ.TypeAlias = typ.Literal[
|
||||||
|
'WINDOW',
|
||||||
|
'HEADER',
|
||||||
|
'CHANNELS',
|
||||||
|
'TEMPORARY',
|
||||||
|
'UI',
|
||||||
|
'TOOLS',
|
||||||
|
'TOOL_PROPS',
|
||||||
|
'ASSET_SHELF',
|
||||||
|
'ASSET_SHELF_HEADER',
|
||||||
|
'PREVIEW',
|
||||||
|
'HUD',
|
||||||
|
'NAVIGATION_BAR',
|
||||||
|
'EXECUTE',
|
||||||
|
'FOOTER',
|
||||||
|
'TOOL_HEADER',
|
||||||
|
'XR',
|
||||||
|
]
|
||||||
BLSpaceType: typ.TypeAlias = typ.Literal[
|
BLSpaceType: typ.TypeAlias = typ.Literal[
|
||||||
'EMPTY',
|
'EMPTY',
|
||||||
'VIEW_3D',
|
'VIEW_3D',
|
||||||
|
@ -131,32 +150,151 @@ BLSpaceType: typ.TypeAlias = typ.Literal[
|
||||||
'SPREADSHEET',
|
'SPREADSHEET',
|
||||||
'PREFERENCES',
|
'PREFERENCES',
|
||||||
]
|
]
|
||||||
BLRegionType: typ.TypeAlias = typ.Literal[
|
|
||||||
'WINDOW',
|
|
||||||
'HEADER',
|
|
||||||
'CHANNELS',
|
|
||||||
'TEMPORARY',
|
|
||||||
'UI',
|
|
||||||
'TOOLS',
|
|
||||||
'TOOL_PROPS',
|
|
||||||
'ASSET_SHELF',
|
|
||||||
'ASSET_SHELF_HEADER',
|
|
||||||
'PREVIEW',
|
|
||||||
'HUD',
|
|
||||||
'NAVIGATION_BAR',
|
|
||||||
'EXECUTE',
|
|
||||||
'FOOTER',
|
|
||||||
'TOOL_HEADER',
|
|
||||||
'XR',
|
|
||||||
]
|
|
||||||
BLOperatorStatus: typ.TypeAlias = set[
|
BLOperatorStatus: typ.TypeAlias = set[
|
||||||
typ.Literal['RUNNING_MODAL', 'CANCELLED', 'FINISHED', 'PASS_THROUGH', 'INTERFACE']
|
typ.Literal['RUNNING_MODAL', 'CANCELLED', 'FINISHED', 'PASS_THROUGH', 'INTERFACE']
|
||||||
]
|
]
|
||||||
|
|
||||||
|
####################
|
||||||
|
# - Operators
|
||||||
|
####################
|
||||||
|
## TODO: Write the rest in.
|
||||||
|
BLEventType: typ.TypeAlias = typ.Literal[
|
||||||
|
'NONE',
|
||||||
|
'LEFTMOUSE',
|
||||||
|
'MIDDLEMOUSE',
|
||||||
|
'RIGHTMOUSE',
|
||||||
|
'BUTTON4MOUSE',
|
||||||
|
'BUTTON5MOUSE',
|
||||||
|
'BUTTON6MOUSE',
|
||||||
|
'BUTTON7MOUSE',
|
||||||
|
'PEN',
|
||||||
|
'ERASOR',
|
||||||
|
'MOUSEMOVE',
|
||||||
|
'INBETWEEN_MOUSEMOVE',
|
||||||
|
'TRACKPADPAN',
|
||||||
|
'TRACKPADZOOM',
|
||||||
|
'MOUSEROTATE',
|
||||||
|
'MOUSESMARTZOOM',
|
||||||
|
'WHEELUPMOUSE',
|
||||||
|
'WHEELDOWNMOUSE',
|
||||||
|
'WHEELINMOUSE',
|
||||||
|
'WHEELOUTMOUSE',
|
||||||
|
'A',
|
||||||
|
'B',
|
||||||
|
'C',
|
||||||
|
'D',
|
||||||
|
'E',
|
||||||
|
'F',
|
||||||
|
'G',
|
||||||
|
'H',
|
||||||
|
'I',
|
||||||
|
'J',
|
||||||
|
'K',
|
||||||
|
'L',
|
||||||
|
'M',
|
||||||
|
'N',
|
||||||
|
'O',
|
||||||
|
'P',
|
||||||
|
'Q',
|
||||||
|
'R',
|
||||||
|
'S',
|
||||||
|
'T',
|
||||||
|
'U',
|
||||||
|
'V',
|
||||||
|
'W',
|
||||||
|
'X',
|
||||||
|
'Y',
|
||||||
|
'Z',
|
||||||
|
'ZERO',
|
||||||
|
'ONE',
|
||||||
|
'TWO',
|
||||||
|
'THREE',
|
||||||
|
'FOUR',
|
||||||
|
'FIVE',
|
||||||
|
'SIX',
|
||||||
|
'SEVEN',
|
||||||
|
'EIGHT',
|
||||||
|
'NINE',
|
||||||
|
'LEFT_CTRL',
|
||||||
|
'LEFT_ALT',
|
||||||
|
'LEFT_SHIFT',
|
||||||
|
'RIGHT_ALT',
|
||||||
|
'RIGHT_CTRL',
|
||||||
|
'RIGHT_SHIFT',
|
||||||
|
'ESC',
|
||||||
|
'TAB',
|
||||||
|
'RET', ## Enter
|
||||||
|
'SPACE',
|
||||||
|
'LINE_FEED',
|
||||||
|
'BACK_SPACE',
|
||||||
|
'DEL',
|
||||||
|
'SEMI_COLON',
|
||||||
|
'PERIOD',
|
||||||
|
'COMMA',
|
||||||
|
'QUOTE',
|
||||||
|
'ACCENT_GRAVE',
|
||||||
|
'MINUS',
|
||||||
|
'PLUS',
|
||||||
|
'SLASH',
|
||||||
|
'BACK_SLASH',
|
||||||
|
'EQUAL',
|
||||||
|
'LEFT_BRACKET',
|
||||||
|
'RIGHT_BRACKET',
|
||||||
|
'LEFT_ARROW',
|
||||||
|
'DOWN_ARROW',
|
||||||
|
'RIGHT_ARROW',
|
||||||
|
'UP_ARROW',
|
||||||
|
'NUMPAD_0',
|
||||||
|
'NUMPAD_1',
|
||||||
|
'NUMPAD_2',
|
||||||
|
'NUMPAD_3',
|
||||||
|
'NUMPAD_4',
|
||||||
|
'NUMPAD_5',
|
||||||
|
'NUMPAD_6',
|
||||||
|
'NUMPAD_7',
|
||||||
|
'NUMPAD_8',
|
||||||
|
'NUMPAD_9',
|
||||||
|
'NUMPAD_PERIOD',
|
||||||
|
'NUMPAD_SLASH',
|
||||||
|
'NUMPAD_ASTERIX',
|
||||||
|
'NUMPAD_MINUS',
|
||||||
|
'NUMPAD_PLUS',
|
||||||
|
'NUMPAD_ENTER',
|
||||||
|
'F1',
|
||||||
|
'F2',
|
||||||
|
'F3',
|
||||||
|
'F4',
|
||||||
|
'F5',
|
||||||
|
'F6',
|
||||||
|
'F7',
|
||||||
|
'F8',
|
||||||
|
'F9',
|
||||||
|
'F10',
|
||||||
|
'F11',
|
||||||
|
'F12',
|
||||||
|
'PAUSE',
|
||||||
|
'INSERT',
|
||||||
|
'HOME',
|
||||||
|
'PAGE_UP',
|
||||||
|
'PAGE_DOWN',
|
||||||
|
'END',
|
||||||
|
'MEDIA_PLAY',
|
||||||
|
'MEDIA_STOP',
|
||||||
|
'MEDIA_FIRST',
|
||||||
|
'MEDIA_LAST',
|
||||||
|
]
|
||||||
|
BLEventValue: typ.TypeAlias = typ.Literal[
|
||||||
|
'ANY',
|
||||||
|
'PRESS',
|
||||||
|
'RELEASE',
|
||||||
|
'CLICK',
|
||||||
|
'DOUBLE_CLICK',
|
||||||
|
'CLICK_DRAG',
|
||||||
|
'NOTHING',
|
||||||
|
]
|
||||||
####################
|
####################
|
||||||
# - Addon Types
|
# - Addon Types
|
||||||
####################
|
####################
|
||||||
KeymapItemDef: typ.TypeAlias = typ.Any
|
|
||||||
ManagedObjName = str
|
ManagedObjName = str
|
||||||
|
|
||||||
####################
|
####################
|
|
@ -0,0 +1,125 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
"""Declares types for working with `bpy.app.handlers` callbacks."""
|
||||||
|
|
||||||
|
import typing as typ
|
||||||
|
|
||||||
|
import bpy
|
||||||
|
import pydantic as pyd
|
||||||
|
|
||||||
|
from oscillode.utils.staticproperty import staticproperty
|
||||||
|
|
||||||
|
BLHandler = typ.Callable[[], None]
|
||||||
|
BLHandlerWithFile = typ.Callable[[str], None]
|
||||||
|
BLHandlerWithRenderStats = typ.Callable[[typ.Any], None]
|
||||||
|
|
||||||
|
|
||||||
|
class BLHandlers(pyd.BaseModel):
|
||||||
|
"""Contains lists of handlers associated with this addon."""
|
||||||
|
|
||||||
|
animation_playback_post: tuple[BLHandler, ...] = ()
|
||||||
|
animation_playback_pre: tuple[BLHandler, ...] = ()
|
||||||
|
annotation_post: tuple[BLHandler, ...] = ()
|
||||||
|
annotation_pre: tuple[BLHandler, ...] = ()
|
||||||
|
composite_cancel: tuple[BLHandler, ...] = ()
|
||||||
|
composite_post: tuple[BLHandler, ...] = ()
|
||||||
|
composite_pre: tuple[BLHandler, ...] = ()
|
||||||
|
depsgraph_update_post: tuple[BLHandler, ...] = ()
|
||||||
|
depsgraph_update_pre: tuple[BLHandler, ...] = ()
|
||||||
|
frame_change_post: tuple[BLHandler, ...] = ()
|
||||||
|
frame_change_pre: tuple[BLHandler, ...] = ()
|
||||||
|
load_factory_preferences_post: tuple[BLHandler, ...] = ()
|
||||||
|
load_factory_startup_post: tuple[BLHandler, ...] = ()
|
||||||
|
load_post: tuple[BLHandlerWithFile, ...] = ()
|
||||||
|
load_post_fail: tuple[BLHandlerWithFile, ...] = ()
|
||||||
|
load_pre: tuple[BLHandlerWithFile, ...] = ()
|
||||||
|
object_bake_cancel: tuple[BLHandler, ...] = ()
|
||||||
|
object_bake_complete: tuple[BLHandler, ...] = ()
|
||||||
|
object_bake_pre: tuple[BLHandler, ...] = ()
|
||||||
|
redo_post: tuple[BLHandler, ...] = ()
|
||||||
|
redo_pre: tuple[BLHandler, ...] = ()
|
||||||
|
render_cancel: tuple[BLHandler, ...] = ()
|
||||||
|
render_complete: tuple[BLHandler, ...] = ()
|
||||||
|
render_init: tuple[BLHandler, ...] = ()
|
||||||
|
render_post: tuple[BLHandler, ...] = ()
|
||||||
|
render_pre: tuple[BLHandler, ...] = ()
|
||||||
|
render_stats: tuple[BLHandler, ...] = ()
|
||||||
|
## TODO: Verify these type signatures.
|
||||||
|
|
||||||
|
## TODO: A validator to check that all handlers are decorated with bpy.app.handlers.persistent
|
||||||
|
|
||||||
|
####################
|
||||||
|
# - Properties
|
||||||
|
####################
|
||||||
|
@staticproperty # type: ignore[arg-type]
|
||||||
|
def handler_categories() -> tuple[str, ...]: # type: ignore[misc]
|
||||||
|
"""Returns an immutable string sequence of handler categories."""
|
||||||
|
return (
|
||||||
|
'animation_playback_post',
|
||||||
|
'animation_playback_pre',
|
||||||
|
'annotation_post',
|
||||||
|
'annotation_pre',
|
||||||
|
'composite_cancel',
|
||||||
|
'composite_post',
|
||||||
|
'composite_pre',
|
||||||
|
'depsgraph_update_post',
|
||||||
|
'depsgraph_update_pre',
|
||||||
|
'frame_change_post',
|
||||||
|
'frame_change_pre',
|
||||||
|
'load_factory_preferences_post',
|
||||||
|
'load_factory_startup_post',
|
||||||
|
'load_post',
|
||||||
|
'load_post_fail',
|
||||||
|
'load_pre',
|
||||||
|
'object_bake_cancel',
|
||||||
|
'object_bake_complete',
|
||||||
|
'object_bake_pre',
|
||||||
|
'redo_post',
|
||||||
|
'redo_pre',
|
||||||
|
'render_cancel',
|
||||||
|
'render_complete',
|
||||||
|
'render_init',
|
||||||
|
'render_post',
|
||||||
|
'render_pre',
|
||||||
|
'render_stats',
|
||||||
|
)
|
||||||
|
|
||||||
|
####################
|
||||||
|
# - Merging
|
||||||
|
####################
|
||||||
|
def __add__(self, other: typ.Self) -> typ.Self:
|
||||||
|
"""Concatenate the handlers of two `BLHandlers` objects."""
|
||||||
|
return BLHandlers(
|
||||||
|
**{
|
||||||
|
hndl_cat: getattr(self, hndl_cat) + getattr(self, hndl_cat)
|
||||||
|
for hndl_cat in self.handler_categories
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
def register(self) -> None:
|
||||||
|
"""Registers all handlers declared by-category."""
|
||||||
|
for handler_category in BLHandlers.handler_categories:
|
||||||
|
for handler in getattr(self, handler_category):
|
||||||
|
getattr(bpy.app.handlers, handler_category).append(handler)
|
||||||
|
|
||||||
|
def unregister(self) -> None:
|
||||||
|
"""Unregisters only this addon's handlers from bpy.app.handlers."""
|
||||||
|
for handler_category in BLHandlers.handler_categories:
|
||||||
|
for handler in getattr(self, handler_category):
|
||||||
|
bpy_handlers = getattr(bpy.app.handlers, handler_category)
|
||||||
|
if handler in bpy_handlers:
|
||||||
|
bpy_handlers.remove(handler)
|
|
@ -0,0 +1,60 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
"""Declares types for working with `bpy.types.KeyMap`s."""
|
||||||
|
|
||||||
|
import bpy
|
||||||
|
import pydantic as pyd
|
||||||
|
|
||||||
|
from .bl import BLEventType, BLEventValue, BLSpaceType
|
||||||
|
from .operator_types import OperatorType
|
||||||
|
|
||||||
|
|
||||||
|
class BLKeymapItem(pyd.BaseModel):
|
||||||
|
"""Contains lists of handlers associated with this addon."""
|
||||||
|
|
||||||
|
operator: OperatorType
|
||||||
|
|
||||||
|
event_type: BLEventType
|
||||||
|
event_value: BLEventValue
|
||||||
|
|
||||||
|
shift: bool = False
|
||||||
|
ctrl: bool = False
|
||||||
|
alt: bool = False
|
||||||
|
key_modifier: BLEventType = 'NONE'
|
||||||
|
|
||||||
|
space_type: BLSpaceType = 'EMPTY'
|
||||||
|
|
||||||
|
def register(self, addon_keymap: bpy.types.KeyMap) -> bpy.types.KeyMapItem:
|
||||||
|
"""Registers this hotkey with an addon keymap.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
ValueError: If the `space_type` constraint of the addon keymap does not match the `space_type` constraint of this `BLKeymapItem`.
|
||||||
|
"""
|
||||||
|
if self.space_type == addon_keymap.space_type:
|
||||||
|
addon_keymap.keymap_items.new(
|
||||||
|
self.operator,
|
||||||
|
self.event_type,
|
||||||
|
self.event_value,
|
||||||
|
shift=self.shift,
|
||||||
|
ctrl=self.ctrl,
|
||||||
|
alt=self.alt,
|
||||||
|
key_modifier=self.key_modifier,
|
||||||
|
)
|
||||||
|
|
||||||
|
msg = f'Addon keymap space type {addon_keymap.space_type} does not match space_type of BLKeymapItem to register: {self}'
|
||||||
|
raise ValueError(msg)
|
||||||
|
## TODO: Check if space_type matches?
|
|
@ -1,5 +1,5 @@
|
||||||
# blender_maxwell
|
# oscillode
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU Affero General Public License as published by
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -14,10 +14,14 @@
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
"""Provides an enum that semantically constrains the use of icons throughout the addon."""
|
||||||
|
|
||||||
import enum
|
import enum
|
||||||
|
|
||||||
|
|
||||||
class Icon(enum.StrEnum):
|
class Icon(enum.StrEnum):
|
||||||
|
"""Identifiers for icons used throughout this addon."""
|
||||||
|
|
||||||
# Node Tree
|
# Node Tree
|
||||||
SimNodeEditor = 'MOD_SIMPLEDEFORM'
|
SimNodeEditor = 'MOD_SIMPLEDEFORM'
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# blender_maxwell
|
# oscillode
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU Affero General Public License as published by
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -14,12 +14,16 @@
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
"""Provides identifiers for objects in Blender that are managed on behalf of the user, for use by the addon, in order to provide a safe and streamlined integration of more complex data representations that flow between the addon and Blender."""
|
||||||
|
|
||||||
import enum
|
import enum
|
||||||
|
|
||||||
from blender_maxwell.utils import blender_type_enum
|
from oscillode.utils import blender_type_enum
|
||||||
|
|
||||||
|
|
||||||
class ManagedObjType(blender_type_enum.BlenderTypeEnum):
|
class ManagedObjType(blender_type_enum.BlenderTypeEnum):
|
||||||
|
"""Identifiers for 'managed objects', which encapsulates a particular Blender object and provides alternative semantics more suited to the needs of this addon."""
|
||||||
|
|
||||||
ManagedBLImage = enum.auto()
|
ManagedBLImage = enum.auto()
|
||||||
|
|
||||||
ManagedBLCollection = enum.auto()
|
ManagedBLCollection = enum.auto()
|
|
@ -1,5 +1,5 @@
|
||||||
# blender_maxwell
|
# oscillode
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU Affero General Public License as published by
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -14,11 +14,15 @@
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
"""Provides identifiers for node trees defined by this addon."""
|
||||||
|
|
||||||
import enum
|
import enum
|
||||||
|
|
||||||
from blender_maxwell.utils import blender_type_enum
|
from oscillode.utils import blender_type_enum
|
||||||
|
|
||||||
|
|
||||||
@blender_type_enum.append_cls_name_to_values
|
@blender_type_enum.append_cls_name_to_values
|
||||||
class TreeType(blender_type_enum.BlenderTypeEnum):
|
class NodeTreeType(blender_type_enum.BlenderTypeEnum):
|
||||||
|
"""Identifiers for addon-defined node trees."""
|
||||||
|
|
||||||
MaxwellSim = enum.auto()
|
MaxwellSim = enum.auto()
|
|
@ -1,5 +1,5 @@
|
||||||
# blender_maxwell
|
# oscillode
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU Affero General Public License as published by
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -14,11 +14,12 @@
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
"""Defines Operator Types as an enum, making it easy for any part of the addon to refer to any operator."""
|
"""Provides identifiers for Blender operators defined by this addon."""
|
||||||
|
|
||||||
import enum
|
import enum
|
||||||
|
|
||||||
from ..nodeps.utils import blender_type_enum
|
from oscillode.utils import blender_type_enum
|
||||||
|
|
||||||
from .addon import NAME as ADDON_NAME
|
from .addon import NAME as ADDON_NAME
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# blender_maxwell
|
# oscillode
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU Affero General Public License as published by
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
import enum
|
import enum
|
||||||
|
|
||||||
from blender_maxwell.nodeps.utils import blender_type_enum
|
from oscillode.utils import blender_type_enum
|
||||||
|
|
||||||
from .addon import NAME as ADDON_NAME
|
from .addon import NAME as ADDON_NAME
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# blender_maxwell
|
# oscillode
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU Affero General Public License as published by
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -14,13 +14,10 @@
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
"""Provides various useful managed objects, which enables the clean and safe use of objects external to this addon."""
|
||||||
|
|
||||||
from .base import ManagedObj
|
from .base import ManagedObj
|
||||||
|
|
||||||
# from .managed_bl_empty import ManagedBLEmpty
|
|
||||||
from .managed_bl_image import ManagedBLImage
|
from .managed_bl_image import ManagedBLImage
|
||||||
|
|
||||||
# from .managed_bl_collection import ManagedBLCollection
|
|
||||||
# from .managed_bl_object import ManagedBLObject
|
|
||||||
from .managed_bl_mesh import ManagedBLMesh
|
from .managed_bl_mesh import ManagedBLMesh
|
||||||
|
|
||||||
# from .managed_bl_volume import ManagedBLVolume
|
# from .managed_bl_volume import ManagedBLVolume
|
||||||
|
@ -28,13 +25,8 @@ from .managed_bl_modifier import ManagedBLModifier
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
'ManagedObj',
|
'ManagedObj',
|
||||||
#'ManagedBLEmpty',
|
|
||||||
'ManagedBLImage',
|
'ManagedBLImage',
|
||||||
#'ManagedBLCollection',
|
|
||||||
#'ManagedBLObject',
|
|
||||||
'ManagedBLMesh',
|
'ManagedBLMesh',
|
||||||
#'ManagedBLVolume',
|
#'ManagedBLVolume',
|
||||||
'ManagedBLModifier',
|
'ManagedBLModifier',
|
||||||
]
|
]
|
||||||
|
|
||||||
## REMEMBER: Add the appropriate entry to the bl_cache.DECODER
|
|
|
@ -0,0 +1,125 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
"""Provides the base protocol on which all ManagedObjs are derived, as well as explicit protocols describing common features supported by some `ManagedObjs`."""
|
||||||
|
|
||||||
|
import abc
|
||||||
|
import typing as typ
|
||||||
|
|
||||||
|
from blender_maxwell.utils import logger, serialize
|
||||||
|
|
||||||
|
from .. import contracts as ct
|
||||||
|
|
||||||
|
log = logger.get(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
class ManagedObj(typ.Protocol):
|
||||||
|
"""A weak name-based reference to some kind of object external to this software.
|
||||||
|
|
||||||
|
While the object doesn't have to come from Blender's `bpy.types`, that is the driving motivation for this class: To encapsulate access to the powerful visual tools granted by Blender's 3D viewport, image editor, and UI.
|
||||||
|
Through extensive trial-and-error, this transparently-cached immediate-mode interface has emerged as the best compromise.
|
||||||
|
|
||||||
|
While not suited to all use cases, the `ManagedObj` paradigm is ideal for the common situation of 'node ownership of external logic'.
|
||||||
|
For example, a plotting node needs access to its own image buffer; however, for it to be displayable, that image buffer must be owned by Blender.
|
||||||
|
This is where `ManagedObj` provides the ability of the plotting node to "loosely own" a particular Blender image, which both allows the user to see/interact with the image as a typical Blender image, but also allows the node to drive ex. lifecycle (like removing the image plot when the node is deleted).
|
||||||
|
|
||||||
|
This approach of loose name-coupling is not perfect. To name a few examples:
|
||||||
|
|
||||||
|
- A particular challenge is that of identifying and namespacing managed datablocks. The user may, for example, change the name of an object - and what do we do then? Is generating new data under the now-vacant name a feature? Or is it a systematic memory leak backed by dangling fake-owned datablocks?
|
||||||
|
- The precise definition of "loose ownership" is itself a matter of taste. Stronger ownership presumptions allow for stronger guarantees and simpler caching - but at the cost of more brittle breaks when the underlying objects are manipulated in ways we don't expect.
|
||||||
|
- `.blend` persistance is not the default when it comes to certain Blender objects, which raises deeper UX questions about how opinionated we should be about where users put data.
|
||||||
|
- Solving this doesn't help actually deal with data. There's a lot of very specific nuance in every single data pipeline, and that complexity is only added to watever this approach incurs.
|
||||||
|
|
||||||
|
This abstract base class serves to provide a few of the most basic of commonly-available operations.
|
||||||
|
In particular, implementations of `dump_as_msgspec`/`parse_as_msgspec` are enforced, for use with `oscillode.utils.serialize`.
|
||||||
|
This way, ex. opening a `.blend` file will allow a newly-deserialized `ManagedObj` to re-attach transparently to the also-persisted underlying datablock.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
managed_obj_type: Enum identifier indicating which of the `ct.ManagedObjType` the instance should declare itself as.
|
||||||
|
"""
|
||||||
|
|
||||||
|
managed_obj_type: ct.ManagedObjType
|
||||||
|
|
||||||
|
@abc.abstractmethod
|
||||||
|
def __init__(self, name: ct.ManagedObjName, prev_name: str | None = None):
|
||||||
|
"""Initializes the managed object with a unique name.
|
||||||
|
|
||||||
|
Use `prev_name` to indicate that the managed object will initially be avaiable under `prev_name`, but that it should be renamed to `name`.
|
||||||
|
"""
|
||||||
|
|
||||||
|
####################
|
||||||
|
# - Properties
|
||||||
|
####################
|
||||||
|
@property
|
||||||
|
@abc.abstractmethod
|
||||||
|
def name(self) -> str:
|
||||||
|
"""Retrieve the name of the managed object."""
|
||||||
|
|
||||||
|
@name.setter
|
||||||
|
@abc.abstractmethod
|
||||||
|
def name(self, value: str) -> None:
|
||||||
|
"""Retrieve the name of the managed object."""
|
||||||
|
|
||||||
|
####################
|
||||||
|
# - Methods
|
||||||
|
####################
|
||||||
|
@abc.abstractmethod
|
||||||
|
def free(self) -> None:
|
||||||
|
"""Cleanup the resources managed by the managed object."""
|
||||||
|
|
||||||
|
@abc.abstractmethod
|
||||||
|
def hide_preview(self) -> None:
|
||||||
|
"""Hide any active preview of the managed object, if it exists, and if such an operation makes sense."""
|
||||||
|
|
||||||
|
####################
|
||||||
|
# - Serialization
|
||||||
|
####################
|
||||||
|
def dump_as_msgspec(self) -> serialize.NaiveRepresentation:
|
||||||
|
"""Bijectively transform this managed object into a 'naive representation' that uses only basic Python types, which may be serialized cleanly."""
|
||||||
|
return [
|
||||||
|
serialize.TypeID.ManagedObj,
|
||||||
|
self.__class__.__name__,
|
||||||
|
self.name,
|
||||||
|
]
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def parse_as_msgspec(obj: serialize.NaiveRepresentation) -> typ.Self:
|
||||||
|
"""Bijectively construct an instance of this managed object from the 'naive representation', which may have been deserialized into."""
|
||||||
|
return next(
|
||||||
|
subclass(obj[2])
|
||||||
|
for subclass in ManagedObj.__subclasses__()
|
||||||
|
if subclass.__name__ == obj[1]
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
####################
|
||||||
|
# - Support Flags
|
||||||
|
####################
|
||||||
|
class SupportsBlenderSelect(typ.Protocol):
|
||||||
|
"""Protocol guaranteeing the ability to select the object in Blender."""
|
||||||
|
|
||||||
|
def bl_select(self) -> None:
|
||||||
|
"""Select the managed object in Blender."""
|
||||||
|
|
||||||
|
|
||||||
|
class Supportsreview(typ.Protocol):
|
||||||
|
"""Protocol guaranteeing support for previewing the object."""
|
||||||
|
|
||||||
|
def show_preview(self) -> None:
|
||||||
|
"""Shows a preview of the managed object."""
|
||||||
|
|
||||||
|
def hide_preview(self) -> None:
|
||||||
|
"""Hide any active preview of the managed object, if it exists."""
|
|
@ -1,3 +1,19 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# blender_maxwell
|
# blender_maxwell
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 blender_maxwell Project Contributors
|
||||||
#
|
#
|
||||||
|
@ -16,12 +32,12 @@
|
||||||
|
|
||||||
import bpy
|
import bpy
|
||||||
|
|
||||||
from blender_maxwell.utils import logger
|
from oscillode.utils import logger
|
||||||
|
|
||||||
log = logger.get(__name__)
|
log = logger.get(__name__)
|
||||||
|
|
||||||
MANAGED_COLLECTION_NAME = 'BLMaxwell'
|
MANAGED_COLLECTION_NAME = 'Oscillode'
|
||||||
PREVIEW_COLLECTION_NAME = 'BLMaxwell Visible'
|
PREVIEW_COLLECTION_NAME = 'Oscillode Visible'
|
||||||
|
|
||||||
|
|
||||||
####################
|
####################
|
|
@ -1,5 +1,5 @@
|
||||||
# blender_maxwell
|
# oscillode
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU Affero General Public License as published by
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
"""Declares `ManagedBLImage`."""
|
"""Declares an object encapsulating access to a Blender image datablock from this addon."""
|
||||||
|
|
||||||
import time
|
import time
|
||||||
import typing as typ
|
import typing as typ
|
||||||
|
@ -23,15 +23,17 @@ import bpy
|
||||||
import matplotlib.axis as mpl_ax
|
import matplotlib.axis as mpl_ax
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from blender_maxwell.utils import image_ops, logger
|
from oscillode.utils import image_ops, logger
|
||||||
|
|
||||||
from .. import contracts as ct
|
from .. import contracts as ct
|
||||||
from . import base
|
from . import base
|
||||||
|
|
||||||
log = logger.get(__name__)
|
log = logger.get(__name__)
|
||||||
|
|
||||||
AREA_TYPE = 'IMAGE_EDITOR'
|
AREA_TYPE: ct.BLSpaceType = (
|
||||||
SPACE_TYPE = 'IMAGE_EDITOR'
|
'IMAGE_EDITOR' ##TODO: Is SpaceType different than AreaType?
|
||||||
|
)
|
||||||
|
SPACE_TYPE: ct.BLSpaceType = 'IMAGE_EDITOR'
|
||||||
|
|
||||||
|
|
||||||
####################
|
####################
|
||||||
|
@ -44,7 +46,7 @@ class ManagedBLImage(base.ManagedObj):
|
||||||
name: The name of the image.
|
name: The name of the image.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
managed_obj_type = ct.ManagedObjType.ManagedBLImage
|
managed_obj_type: str = ct.ManagedObjType.ManagedBLImage
|
||||||
_bl_image_name: str
|
_bl_image_name: str
|
||||||
|
|
||||||
def __init__(self, name: str, prev_name: str | None = None):
|
def __init__(self, name: str, prev_name: str | None = None):
|
||||||
|
@ -170,6 +172,7 @@ class ManagedBLImage(base.ManagedObj):
|
||||||
####################
|
####################
|
||||||
# - Methods
|
# - Methods
|
||||||
####################
|
####################
|
||||||
|
## TODO: Rename to show_preview()
|
||||||
def bl_select(self) -> None:
|
def bl_select(self) -> None:
|
||||||
"""Selects the image by loading it into an on-screen UI area/space.
|
"""Selects the image by loading it into an on-screen UI area/space.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# blender_maxwell
|
# oscillode
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU Affero General Public License as published by
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -21,7 +21,7 @@ import bpy
|
||||||
import jax
|
import jax
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from blender_maxwell.utils import logger
|
from oscillode.utils import logger
|
||||||
|
|
||||||
from .. import contracts as ct
|
from .. import contracts as ct
|
||||||
from . import base
|
from . import base
|
|
@ -1,5 +1,5 @@
|
||||||
# blender_maxwell
|
# oscillode
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU Affero General Public License as published by
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -16,13 +16,15 @@
|
||||||
|
|
||||||
"""A managed Blender modifier, associated with some Blender object."""
|
"""A managed Blender modifier, associated with some Blender object."""
|
||||||
|
|
||||||
|
## TODO: Make a common core for modifier manipulation, then specify each modifier as a seperate ManagedObj.
|
||||||
|
|
||||||
import typing as typ
|
import typing as typ
|
||||||
|
|
||||||
import bpy
|
import bpy
|
||||||
import jax
|
import jax
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from blender_maxwell.utils import logger
|
from oscillode.utils import logger
|
||||||
|
|
||||||
from .. import bl_socket_map
|
from .. import bl_socket_map
|
||||||
from .. import contracts as ct
|
from .. import contracts as ct
|
||||||
|
@ -124,7 +126,7 @@ def write_modifier_geonodes(
|
||||||
modifier_altered = True
|
modifier_altered = True
|
||||||
## TODO: More fine-grained alterations?
|
## TODO: More fine-grained alterations?
|
||||||
|
|
||||||
return modifier_altered # noqa: RET504
|
return modifier_altered
|
||||||
|
|
||||||
|
|
||||||
####################
|
####################
|
||||||
|
@ -154,6 +156,8 @@ def write_modifier(
|
||||||
# - ManagedObj
|
# - ManagedObj
|
||||||
####################
|
####################
|
||||||
class ManagedBLModifier(base.ManagedObj):
|
class ManagedBLModifier(base.ManagedObj):
|
||||||
|
"""Manages a particular modifier attached to a Blender mesh also managed by this construction."""
|
||||||
|
|
||||||
managed_obj_type = ct.ManagedObjType.ManagedBLModifier
|
managed_obj_type = ct.ManagedObjType.ManagedBLModifier
|
||||||
_modifier_name: str | None = None
|
_modifier_name: str | None = None
|
||||||
twin_bl_mesh: ManagedBLMesh | None = None
|
twin_bl_mesh: ManagedBLMesh | None = None
|
|
@ -1,5 +1,5 @@
|
||||||
# blender_maxwell
|
# oscillode
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU Affero General Public License as published by
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -16,14 +16,11 @@
|
||||||
|
|
||||||
"""Declares `ManagedBLText`."""
|
"""Declares `ManagedBLText`."""
|
||||||
|
|
||||||
import time
|
|
||||||
import typing as typ
|
import typing as typ
|
||||||
|
|
||||||
import bpy
|
import bpy
|
||||||
import matplotlib.axis as mpl_ax
|
|
||||||
import numpy as np
|
|
||||||
|
|
||||||
from blender_maxwell.utils import image_ops, logger
|
from oscillode.utils import logger
|
||||||
|
|
||||||
from .. import contracts as ct
|
from .. import contracts as ct
|
||||||
from . import base
|
from . import base
|
||||||
|
@ -38,10 +35,10 @@ SPACE_TYPE = 'IMAGE_EDITOR'
|
||||||
# - Managed BL Image
|
# - Managed BL Image
|
||||||
####################
|
####################
|
||||||
class ManagedBLText(base.ManagedObj):
|
class ManagedBLText(base.ManagedObj):
|
||||||
"""Represents a Blender Image datablock, encapsulating various useful interactions with it.
|
"""Represents a Blender text datablock, encapsulating various useful interactions with it.
|
||||||
|
|
||||||
Attributes:
|
Attributes:
|
||||||
name: The name of the image.
|
name: The name of the text datablock.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
managed_obj_type = ct.ManagedObjType.ManagedBLText
|
managed_obj_type = ct.ManagedObjType.ManagedBLText
|
|
@ -1,3 +1,19 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# blender_maxwell
|
# blender_maxwell
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 blender_maxwell Project Contributors
|
||||||
#
|
#
|
|
@ -1,3 +1,19 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# blender_maxwell
|
# blender_maxwell
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 blender_maxwell Project Contributors
|
||||||
#
|
#
|
|
@ -1,5 +1,5 @@
|
||||||
# blender_maxwell
|
# oscillode
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU Affero General Public License as published by
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -14,17 +14,32 @@
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
"""Internal assets for use via the Python API and/or directly by the user as an asset library."""
|
||||||
|
|
||||||
|
from functools import reduce
|
||||||
|
|
||||||
|
import oscillode.contracts as ct
|
||||||
|
|
||||||
from . import geonodes
|
from . import geonodes
|
||||||
|
|
||||||
BL_REGISTER = [
|
BL_REGISTER: list[ct.BLClass] = [
|
||||||
*geonodes.BL_REGISTER,
|
*geonodes.BL_REGISTER,
|
||||||
]
|
]
|
||||||
|
|
||||||
BL_HOTKEYS = [
|
BL_HANDLERS: ct.BLHandlers = reduce(
|
||||||
*geonodes.BL_HOTKEYS,
|
lambda a, b: a + b,
|
||||||
|
[
|
||||||
|
geonodes.BL_HANDLERS,
|
||||||
|
],
|
||||||
|
ct.BLHandlers(),
|
||||||
|
)
|
||||||
|
|
||||||
|
BL_KEYMAP_ITEMS: list[ct.BLKeymapItem] = [
|
||||||
|
*geonodes.BL_KEYMAP_ITEMS,
|
||||||
]
|
]
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
'BL_REGISTER',
|
'BL_REGISTER',
|
||||||
|
'BL_HANDLERS',
|
||||||
'BL_HOTKEYS',
|
'BL_HOTKEYS',
|
||||||
]
|
]
|
|
@ -1,5 +1,5 @@
|
||||||
# blender_maxwell
|
# oscillode
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU Affero General Public License as published by
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -21,8 +21,8 @@ from pathlib import Path
|
||||||
|
|
||||||
import bpy
|
import bpy
|
||||||
|
|
||||||
from blender_maxwell import contracts as ct
|
from oscillode import contracts as ct
|
||||||
from blender_maxwell.utils import logger
|
from oscillode.utils import logger
|
||||||
|
|
||||||
log = logger.get(__name__)
|
log = logger.get(__name__)
|
||||||
|
|
||||||
|
@ -32,17 +32,17 @@ log = logger.get(__name__)
|
||||||
####################
|
####################
|
||||||
# GeoNodes Paths
|
# GeoNodes Paths
|
||||||
## Internal
|
## Internal
|
||||||
GN_INTERNAL_PATH = ct.addon.PATH_ASSETS / 'internal'
|
GN_INTERNAL_PATH: Path = ct.addon.PATH_ASSETS / 'internal'
|
||||||
GN_INTERNAL_INPUTS_PATH = GN_INTERNAL_PATH / 'input'
|
GN_INTERNAL_INPUTS_PATH: Path = GN_INTERNAL_PATH / 'input'
|
||||||
GN_INTERNAL_SOURCES_PATH = GN_INTERNAL_PATH / 'source'
|
GN_INTERNAL_SOURCES_PATH: Path = GN_INTERNAL_PATH / 'source'
|
||||||
GN_INTERNAL_STRUCTURES_PATH = GN_INTERNAL_PATH / 'structure'
|
GN_INTERNAL_STRUCTURES_PATH: Path = GN_INTERNAL_PATH / 'structure'
|
||||||
GN_INTERNAL_MONITORS_PATH = GN_INTERNAL_PATH / 'monitor'
|
GN_INTERNAL_MONITORS_PATH: Path = GN_INTERNAL_PATH / 'monitor'
|
||||||
GN_INTERNAL_SIMULATIONS_PATH = GN_INTERNAL_PATH / 'simulation'
|
GN_INTERNAL_SIMULATIONS_PATH: Path = GN_INTERNAL_PATH / 'simulation'
|
||||||
|
|
||||||
## Structures
|
## Structures
|
||||||
GN_STRUCTURES_PATH = ct.addon.PATH_ASSETS / 'structures'
|
GN_STRUCTURES_PATH: Path = ct.addon.PATH_ASSETS / 'structures'
|
||||||
GN_STRUCTURES_PRIMITIVES_PATH = GN_STRUCTURES_PATH / 'primitives'
|
GN_STRUCTURES_PRIMITIVES_PATH: Path = GN_STRUCTURES_PATH / 'primitives'
|
||||||
GN_STRUCTURES_ARRAYS_PATH = GN_STRUCTURES_PATH / 'arrays'
|
GN_STRUCTURES_ARRAYS_PATH: Path = GN_STRUCTURES_PATH / 'arrays'
|
||||||
|
|
||||||
|
|
||||||
class GeoNodes(enum.StrEnum):
|
class GeoNodes(enum.StrEnum):
|
||||||
|
@ -105,7 +105,7 @@ class GeoNodes(enum.StrEnum):
|
||||||
ArrayRing = 'array_ring'
|
ArrayRing = 'array_ring'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def dedicated_node_type(self) -> ct.BLImportMethod:
|
def dedicated_node_type(self) -> str: ## TODO: How to correlate to node_tree?
|
||||||
"""Deduces the denode type that implements a vendored GeoNodes tree (usually just "GeoNodes Structure").
|
"""Deduces the denode type that implements a vendored GeoNodes tree (usually just "GeoNodes Structure").
|
||||||
|
|
||||||
Generally, "GeoNodes Structure' is the generic triangle-mesh node that can do everything.
|
Generally, "GeoNodes Structure' is the generic triangle-mesh node that can do everything.
|
||||||
|
@ -385,7 +385,7 @@ class GeoNodesToStructureNode(bpy.types.Operator):
|
||||||
####################
|
####################
|
||||||
def invoke(
|
def invoke(
|
||||||
self, context: bpy.types.Context, _: bpy.types.Event
|
self, context: bpy.types.Context, _: bpy.types.Event
|
||||||
) -> set[ct.BLOperatorStatus]:
|
) -> ct.BLOperatorStatus:
|
||||||
"""Commences the drag-and-drop of a GeoNodes asset.
|
"""Commences the drag-and-drop of a GeoNodes asset.
|
||||||
|
|
||||||
- Starts the modal timer, which listens for a mouse-release event.
|
- Starts the modal timer, which listens for a mouse-release event.
|
||||||
|
@ -474,10 +474,10 @@ class GeoNodesToStructureNode(bpy.types.Operator):
|
||||||
## 3. We compute it manually, to avoid the jank.
|
## 3. We compute it manually, to avoid the jank.
|
||||||
node_location = get_view_location(
|
node_location = get_view_location(
|
||||||
editor_region,
|
editor_region,
|
||||||
[
|
(
|
||||||
event.mouse_x - editor_region.x,
|
event.mouse_x - editor_region.x,
|
||||||
event.mouse_y - editor_region.y,
|
event.mouse_y - editor_region.y,
|
||||||
],
|
),
|
||||||
context.preferences.system.ui_scale,
|
context.preferences.system.ui_scale,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -526,8 +526,8 @@ ASSET_LIB_SPECS: dict[str, Path] = {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@bpy.app.handlers.persistent
|
@bpy.app.handlers.persistent # type: ignore[misc]
|
||||||
def initialize_asset_libraries(_: bpy.types.Scene):
|
def initialize_asset_libraries(_: bpy.types.Scene) -> None:
|
||||||
"""Before loading a `.blend` file, ensure that the WindowManager properties relied on by NodeAssetPanel are available.
|
"""Before loading a `.blend` file, ensure that the WindowManager properties relied on by NodeAssetPanel are available.
|
||||||
|
|
||||||
- Several asset libraries, defined under the global `ASSET_LIB_SPECS`, are added/replaced such that the name:path map is respected.
|
- Several asset libraries, defined under the global `ASSET_LIB_SPECS`, are added/replaced such that the name:path map is respected.
|
||||||
|
@ -580,11 +580,11 @@ def initialize_asset_libraries(_: bpy.types.Scene):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
bpy.app.handlers.load_pre.append(initialize_asset_libraries)
|
|
||||||
|
|
||||||
BL_REGISTER = [
|
BL_REGISTER = [
|
||||||
NodeAssetPanel,
|
NodeAssetPanel,
|
||||||
GeoNodesToStructureNode,
|
GeoNodesToStructureNode,
|
||||||
]
|
]
|
||||||
|
|
||||||
BL_HOTKEYS = []
|
BL_HANDLERS: ct.BLHandlers = ct.BLHandlers(load_pre=(initialize_asset_libraries,))
|
||||||
|
|
||||||
|
BL_KEYMAP_ITEMS: list[ct.BLKeymapItem] = []
|
|
@ -1,3 +1,19 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# blender_maxwell
|
# blender_maxwell
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 blender_maxwell Project Contributors
|
||||||
#
|
#
|
||||||
|
@ -22,7 +38,6 @@ Attributes:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import bpy
|
import bpy
|
||||||
|
|
||||||
from blender_maxwell.utils import logger as _logger
|
from blender_maxwell.utils import logger as _logger
|
||||||
|
|
||||||
from . import contracts as ct
|
from . import contracts as ct
|
||||||
|
@ -30,6 +45,8 @@ from . import sockets
|
||||||
|
|
||||||
log = _logger.get(__name__)
|
log = _logger.get(__name__)
|
||||||
|
|
||||||
|
## TODO: Coordinate w/refactor of managed modifiers; for example, the contents of this file would be ideally specified as the implementation of a Protocol, for the particular case of this node tree.
|
||||||
|
|
||||||
|
|
||||||
####################
|
####################
|
||||||
# - Blender -> Socket Def(s)
|
# - Blender -> Socket Def(s)
|
|
@ -1,3 +1,19 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# blender_maxwell
|
# blender_maxwell
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 blender_maxwell Project Contributors
|
||||||
#
|
#
|
||||||
|
@ -22,6 +38,9 @@ import nodeitems_utils
|
||||||
from . import contracts as ct
|
from . import contracts as ct
|
||||||
from .nodes import BL_NODES
|
from .nodes import BL_NODES
|
||||||
|
|
||||||
|
## TODO: Completely refactor this file, and rename it to reflect that it doesn't define or implement any categories - it simply, dumbly, implements the menu.
|
||||||
|
## - Actually; we could delete this file by refactoring it, implementing the logic in a utils/ module, then running the dangling registration as a rote-registration matter in __init__.py.
|
||||||
|
|
||||||
DYNAMIC_SUBMENU_REGISTRATIONS = []
|
DYNAMIC_SUBMENU_REGISTRATIONS = []
|
||||||
|
|
||||||
|
|
||||||
|
@ -101,7 +120,7 @@ BL_REGISTER = [*DYNAMIC_SUBMENU_REGISTRATIONS] ## Must be run after, right now.
|
||||||
|
|
||||||
|
|
||||||
def menu_draw(self, context):
|
def menu_draw(self, context):
|
||||||
if context.space_data.tree_type == ct.TreeType.MaxwellSim.value:
|
if context.space_data.tree_type == ct.NodeTreeType.MaxwellSim.value:
|
||||||
for nodeitem_or_submenu in BL_NODE_CATEGORIES:
|
for nodeitem_or_submenu in BL_NODE_CATEGORIES:
|
||||||
if isinstance(nodeitem_or_submenu, str):
|
if isinstance(nodeitem_or_submenu, str):
|
||||||
submenu_id = nodeitem_or_submenu
|
submenu_id = nodeitem_or_submenu
|
|
@ -1,3 +1,19 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# blender_maxwell
|
# blender_maxwell
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 blender_maxwell Project Contributors
|
||||||
#
|
#
|
||||||
|
@ -15,6 +31,8 @@
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from blender_maxwell.contracts import (
|
from blender_maxwell.contracts import (
|
||||||
|
UNITS_BLENDER,
|
||||||
|
UNITS_TIDY3D,
|
||||||
BLClass,
|
BLClass,
|
||||||
BLColorRGBA,
|
BLColorRGBA,
|
||||||
BLEnumElement,
|
BLEnumElement,
|
||||||
|
@ -29,8 +47,11 @@ from blender_maxwell.contracts import (
|
||||||
BLPropFlag,
|
BLPropFlag,
|
||||||
BLRegionType,
|
BLRegionType,
|
||||||
BLSpaceType,
|
BLSpaceType,
|
||||||
|
Icon,
|
||||||
KeymapItemDef,
|
KeymapItemDef,
|
||||||
ManagedObjName,
|
ManagedObjName,
|
||||||
|
ManagedObjType,
|
||||||
|
NodeTreeType,
|
||||||
OperatorType,
|
OperatorType,
|
||||||
PanelType,
|
PanelType,
|
||||||
PresetName,
|
PresetName,
|
||||||
|
@ -56,8 +77,6 @@ from .flow_kinds import (
|
||||||
ValueFlow,
|
ValueFlow,
|
||||||
)
|
)
|
||||||
from .flow_signals import FlowSignal
|
from .flow_signals import FlowSignal
|
||||||
from .icons import Icon
|
|
||||||
from .mobj_types import ManagedObjType
|
|
||||||
from .node_types import NodeType
|
from .node_types import NodeType
|
||||||
from .sim_types import (
|
from .sim_types import (
|
||||||
BoundCondType,
|
BoundCondType,
|
||||||
|
@ -74,8 +93,6 @@ from .sim_types import (
|
||||||
)
|
)
|
||||||
from .socket_colors import SOCKET_COLORS
|
from .socket_colors import SOCKET_COLORS
|
||||||
from .socket_types import SocketType
|
from .socket_types import SocketType
|
||||||
from .tree_types import TreeType
|
|
||||||
from .unit_systems import UNITS_BLENDER, UNITS_TIDY3D
|
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
'BLClass',
|
'BLClass',
|
||||||
|
@ -92,16 +109,17 @@ __all__ = [
|
||||||
'BLPropFlag',
|
'BLPropFlag',
|
||||||
'BLRegionType',
|
'BLRegionType',
|
||||||
'BLSpaceType',
|
'BLSpaceType',
|
||||||
|
'Icon',
|
||||||
'KeymapItemDef',
|
'KeymapItemDef',
|
||||||
'ManagedObjName',
|
'ManagedObjName',
|
||||||
|
'ManagedObjType',
|
||||||
|
'NodeTreeType',
|
||||||
'OperatorType',
|
'OperatorType',
|
||||||
'PanelType',
|
'PanelType',
|
||||||
'PresetName',
|
'PresetName',
|
||||||
'PropName',
|
'PropName',
|
||||||
'SocketName',
|
'SocketName',
|
||||||
'addon',
|
'addon',
|
||||||
'Icon',
|
|
||||||
'TreeType',
|
|
||||||
'SocketType',
|
'SocketType',
|
||||||
'SOCKET_COLORS',
|
'SOCKET_COLORS',
|
||||||
'SOCKET_SHAPES',
|
'SOCKET_SHAPES',
|
||||||
|
@ -123,7 +141,6 @@ __all__ = [
|
||||||
'manual_amp_time',
|
'manual_amp_time',
|
||||||
'NodeCategory',
|
'NodeCategory',
|
||||||
'NODE_CAT_LABELS',
|
'NODE_CAT_LABELS',
|
||||||
'ManagedObjType',
|
|
||||||
'FlowEvent',
|
'FlowEvent',
|
||||||
'ArrayFlow',
|
'ArrayFlow',
|
||||||
'CapabilitiesFlow',
|
'CapabilitiesFlow',
|
|
@ -1,3 +1,19 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# blender_maxwell
|
# blender_maxwell
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 blender_maxwell Project Contributors
|
||||||
#
|
#
|
||||||
|
@ -14,6 +30,8 @@
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
## TODO: Unify w/category_types.py
|
||||||
|
|
||||||
from .category_types import NodeCategory as NC # noqa: N817
|
from .category_types import NodeCategory as NC # noqa: N817
|
||||||
|
|
||||||
NODE_CAT_LABELS = {
|
NODE_CAT_LABELS = {
|
|
@ -1,3 +1,19 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# blender_maxwell
|
# blender_maxwell
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 blender_maxwell Project Contributors
|
||||||
#
|
#
|
|
@ -1,5 +1,5 @@
|
||||||
# blender_maxwell
|
# oscillode
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU Affero General Public License as published by
|
# it under the terms of the GNU Affero General Public License as published by
|
|
@ -1,5 +1,5 @@
|
||||||
# blender_maxwell
|
# oscillode
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU Affero General Public License as published by
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -14,7 +14,9 @@
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from .socket_types import SocketType as ST
|
"""Socket base colors for Maxwell Sim sockets."""
|
||||||
|
|
||||||
|
from .socket_types import SocketType as ST # noqa: N817
|
||||||
|
|
||||||
## TODO: Don't just presume sRGB.
|
## TODO: Don't just presume sRGB.
|
||||||
SOCKET_COLORS = {
|
SOCKET_COLORS = {
|
|
@ -1,5 +1,5 @@
|
||||||
# blender_maxwell
|
# oscillode
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU Affero General Public License as published by
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -21,6 +21,8 @@ from blender_maxwell.utils import blender_type_enum
|
||||||
|
|
||||||
@blender_type_enum.append_cls_name_to_values
|
@blender_type_enum.append_cls_name_to_values
|
||||||
class SocketType(blender_type_enum.BlenderTypeEnum):
|
class SocketType(blender_type_enum.BlenderTypeEnum):
|
||||||
|
"""Identifiers for valid sockets in Maxwell Sim node trees."""
|
||||||
|
|
||||||
Expr = enum.auto()
|
Expr = enum.auto()
|
||||||
|
|
||||||
# Base
|
# Base
|
|
@ -1,5 +1,5 @@
|
||||||
# blender_maxwell
|
# oscillode
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU Affero General Public License as published by
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -14,17 +14,17 @@
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import contextlib
|
# TODO: Factor this stuff into a dedicated utils/ module, so that this particular node tree becomes simple (aka. the deathly complicated logic is factored out, and can be ex. unit tested all on its own).
|
||||||
import functools
|
## - Then this file can focus on what is special about a Maxwell Sim node tree, as opposed to the lower-level details of how we've chosen to structure our node trees in general.
|
||||||
|
## - Right now there may not be a distinction. And there may never be. But it's a healthy way to think about the problem.
|
||||||
|
|
||||||
import queue
|
import queue
|
||||||
import typing as typ
|
import typing as typ
|
||||||
|
|
||||||
import bpy
|
import bpy
|
||||||
|
from blender_maxwell.utils import logger
|
||||||
from blender_maxwell.utils import logger, serialize
|
|
||||||
|
|
||||||
from . import contracts as ct
|
from . import contracts as ct
|
||||||
from .managed_objs.managed_bl_image import ManagedBLImage
|
|
||||||
|
|
||||||
log = logger.get(__name__)
|
log = logger.get(__name__)
|
||||||
|
|
||||||
|
@ -304,7 +304,7 @@ class MaxwellSimTree(bpy.types.NodeTree):
|
||||||
In general, only one `MaxwellSimTree` should be active at a time.
|
In general, only one `MaxwellSimTree` should be active at a time.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
bl_idname = ct.TreeType.MaxwellSim.value
|
bl_idname = ct.NodeTreeType.MaxwellSim.value
|
||||||
bl_label = 'Maxwell Sim Editor'
|
bl_label = 'Maxwell Sim Editor'
|
||||||
bl_icon = ct.Icon.SimNodeEditor
|
bl_icon = ct.Icon.SimNodeEditor
|
||||||
|
|
||||||
|
@ -312,6 +312,8 @@ class MaxwellSimTree(bpy.types.NodeTree):
|
||||||
default=True,
|
default=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
viewer_node_type: ct.NodeType = ct.NodeType.Viewer
|
||||||
|
|
||||||
####################
|
####################
|
||||||
# - Init Methods
|
# - Init Methods
|
||||||
####################
|
####################
|
||||||
|
@ -536,7 +538,8 @@ def populate_missing_persistence(_) -> None:
|
||||||
for node_tree in [
|
for node_tree in [
|
||||||
_node_tree
|
_node_tree
|
||||||
for _node_tree in bpy.data.node_groups
|
for _node_tree in bpy.data.node_groups
|
||||||
if _node_tree.bl_idname == ct.TreeType.MaxwellSim.value and _node_tree.is_active
|
if _node_tree.bl_idname == ct.NodeTreeType.MaxwellSim.value
|
||||||
|
and _node_tree.is_active
|
||||||
]:
|
]:
|
||||||
log.debug(
|
log.debug(
|
||||||
'%s: Regenerating Dynamic Field Persistance for NodeTree nodes/sockets',
|
'%s: Regenerating Dynamic Field Persistance for NodeTree nodes/sockets',
|
|
@ -1,5 +1,5 @@
|
||||||
# blender_maxwell
|
# oscillode
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU Affero General Public License as published by
|
# it under the terms of the GNU Affero General Public License as published by
|
|
@ -1,3 +1,19 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# blender_maxwell
|
# blender_maxwell
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 blender_maxwell Project Contributors
|
||||||
#
|
#
|
|
@ -1,3 +1,19 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# blender_maxwell
|
# blender_maxwell
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 blender_maxwell Project Contributors
|
||||||
#
|
#
|
||||||
|
@ -25,7 +41,6 @@ import jax.numpy as jnp
|
||||||
import sympy.physics.units as spu
|
import sympy.physics.units as spu
|
||||||
import tidy3d as td
|
import tidy3d as td
|
||||||
import xarray
|
import xarray
|
||||||
|
|
||||||
from blender_maxwell.utils import bl_cache, logger, sim_symbols
|
from blender_maxwell.utils import bl_cache, logger, sim_symbols
|
||||||
|
|
||||||
from ... import contracts as ct
|
from ... import contracts as ct
|
|
@ -1,3 +1,19 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# blender_maxwell
|
# blender_maxwell
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 blender_maxwell Project Contributors
|
||||||
#
|
#
|
|
@ -1,3 +1,19 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# blender_maxwell
|
# blender_maxwell
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 blender_maxwell Project Contributors
|
||||||
#
|
#
|
||||||
|
@ -21,7 +37,6 @@ import typing as typ
|
||||||
|
|
||||||
import bpy
|
import bpy
|
||||||
import sympy as sp
|
import sympy as sp
|
||||||
|
|
||||||
from blender_maxwell.utils import bl_cache, logger, sim_symbols
|
from blender_maxwell.utils import bl_cache, logger, sim_symbols
|
||||||
from blender_maxwell.utils import sympy_extra as spux
|
from blender_maxwell.utils import sympy_extra as spux
|
||||||
|
|
|
@ -1,3 +1,19 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# blender_maxwell
|
# blender_maxwell
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 blender_maxwell Project Contributors
|
||||||
#
|
#
|
||||||
|
@ -19,7 +35,6 @@
|
||||||
import typing as typ
|
import typing as typ
|
||||||
|
|
||||||
import bpy
|
import bpy
|
||||||
|
|
||||||
from blender_maxwell.utils import bl_cache, logger
|
from blender_maxwell.utils import bl_cache, logger
|
||||||
from blender_maxwell.utils import sympy_extra as spux
|
from blender_maxwell.utils import sympy_extra as spux
|
||||||
|
|
|
@ -1,3 +1,19 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# blender_maxwell
|
# blender_maxwell
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 blender_maxwell Project Contributors
|
||||||
#
|
#
|
||||||
|
@ -22,7 +38,6 @@ See `blender_maxwell.maxwell_sim_nodes.math_system` for the actual mathematics i
|
||||||
import typing as typ
|
import typing as typ
|
||||||
|
|
||||||
import bpy
|
import bpy
|
||||||
|
|
||||||
from blender_maxwell.utils import bl_cache, logger
|
from blender_maxwell.utils import bl_cache, logger
|
||||||
from blender_maxwell.utils import sympy_extra as spux
|
from blender_maxwell.utils import sympy_extra as spux
|
||||||
|
|
|
@ -1,3 +1,19 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# blender_maxwell
|
# blender_maxwell
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 blender_maxwell Project Contributors
|
||||||
#
|
#
|
||||||
|
@ -23,7 +39,6 @@ import bpy
|
||||||
import jax
|
import jax
|
||||||
import jax.numpy as jnp
|
import jax.numpy as jnp
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from blender_maxwell.utils import bl_cache, logger, sim_symbols
|
from blender_maxwell.utils import bl_cache, logger, sim_symbols
|
||||||
|
|
||||||
from .... import contracts as ct
|
from .... import contracts as ct
|
|
@ -1,3 +1,19 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# blender_maxwell
|
# blender_maxwell
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 blender_maxwell Project Contributors
|
||||||
#
|
#
|
||||||
|
@ -21,7 +37,6 @@ import typing as typ
|
||||||
|
|
||||||
import bpy
|
import bpy
|
||||||
import sympy as sp
|
import sympy as sp
|
||||||
|
|
||||||
from blender_maxwell.utils import bl_cache, logger, sim_symbols
|
from blender_maxwell.utils import bl_cache, logger, sim_symbols
|
||||||
from blender_maxwell.utils import sympy_extra as spux
|
from blender_maxwell.utils import sympy_extra as spux
|
||||||
|
|
|
@ -1,3 +1,19 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# blender_maxwell
|
# blender_maxwell
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 blender_maxwell Project Contributors
|
||||||
#
|
#
|
||||||
|
@ -22,10 +38,9 @@ import jaxtyping as jtyp
|
||||||
import matplotlib.axis as mpl_ax
|
import matplotlib.axis as mpl_ax
|
||||||
import sympy as sp
|
import sympy as sp
|
||||||
import sympy.physics.units as spu
|
import sympy.physics.units as spu
|
||||||
from frozendict import frozendict
|
|
||||||
|
|
||||||
from blender_maxwell.utils import bl_cache, image_ops, logger, sim_symbols
|
from blender_maxwell.utils import bl_cache, image_ops, logger, sim_symbols
|
||||||
from blender_maxwell.utils import sympy_extra as spux
|
from blender_maxwell.utils import sympy_extra as spux
|
||||||
|
from frozendict import frozendict
|
||||||
|
|
||||||
from ... import contracts as ct
|
from ... import contracts as ct
|
||||||
from ... import managed_objs, sockets
|
from ... import managed_objs, sockets
|
|
@ -1,3 +1,19 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# blender_maxwell
|
# blender_maxwell
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 blender_maxwell Project Contributors
|
||||||
#
|
#
|
||||||
|
@ -27,7 +43,6 @@ from collections import defaultdict
|
||||||
from types import MappingProxyType
|
from types import MappingProxyType
|
||||||
|
|
||||||
import bpy
|
import bpy
|
||||||
|
|
||||||
from blender_maxwell.utils import bl_cache, bl_instance, logger
|
from blender_maxwell.utils import bl_cache, bl_instance, logger
|
||||||
from blender_maxwell.utils import sympy_extra as spux
|
from blender_maxwell.utils import sympy_extra as spux
|
||||||
|
|
||||||
|
@ -1180,7 +1195,7 @@ class MaxwellSimNode(bpy.types.Node, bl_instance.BLInstance):
|
||||||
Returns:
|
Returns:
|
||||||
Whether or not the node can be instantiated within the given node tree.
|
Whether or not the node can be instantiated within the given node tree.
|
||||||
"""
|
"""
|
||||||
return node_tree.bl_idname == ct.TreeType.MaxwellSim.value
|
return node_tree.bl_idname == ct.NodeTreeType.MaxwellSim
|
||||||
|
|
||||||
def init(self, _: bpy.types.Context) -> None:
|
def init(self, _: bpy.types.Context) -> None:
|
||||||
"""Initialize the node instance, including ID, name, socket, presets, and the execution of any `on_value_changed` methods with the `run_on_init` keyword set.
|
"""Initialize the node instance, including ID, name, socket, presets, and the execution of any `on_value_changed` methods with the `run_on_init` keyword set.
|
|
@ -1,3 +1,19 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# blender_maxwell
|
# blender_maxwell
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 blender_maxwell Project Contributors
|
||||||
#
|
#
|
||||||
|
@ -20,14 +36,11 @@ import typing as typ
|
||||||
import uuid
|
import uuid
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from fractions import Fraction
|
from fractions import Fraction
|
||||||
from types import MappingProxyType
|
|
||||||
|
|
||||||
import bpy
|
import bpy
|
||||||
import jax
|
import jax
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import pydantic as pyd
|
import pydantic as pyd
|
||||||
import sympy as sp
|
|
||||||
|
|
||||||
from blender_maxwell.utils import logger
|
from blender_maxwell.utils import logger
|
||||||
from blender_maxwell.utils import sympy_extra as spux
|
from blender_maxwell.utils import sympy_extra as spux
|
||||||
from blender_maxwell.utils.frozendict import FrozenDict, frozendict
|
from blender_maxwell.utils.frozendict import FrozenDict, frozendict
|
|
@ -1,3 +1,19 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# blender_maxwell
|
# blender_maxwell
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 blender_maxwell Project Contributors
|
||||||
#
|
#
|
|
@ -1,3 +1,19 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# blender_maxwell
|
# blender_maxwell
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 blender_maxwell Project Contributors
|
||||||
#
|
#
|
|
@ -1,3 +1,19 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# blender_maxwell
|
# blender_maxwell
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 blender_maxwell Project Contributors
|
||||||
#
|
#
|
|
@ -1,3 +1,19 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# blender_maxwell
|
# blender_maxwell
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 blender_maxwell Project Contributors
|
||||||
#
|
#
|
|
@ -1,3 +1,19 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# blender_maxwell
|
# blender_maxwell
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 blender_maxwell Project Contributors
|
||||||
#
|
#
|
||||||
|
@ -20,10 +36,9 @@ import typing as typ
|
||||||
|
|
||||||
import bpy
|
import bpy
|
||||||
import sympy as sp
|
import sympy as sp
|
||||||
from frozendict import frozendict
|
|
||||||
|
|
||||||
from blender_maxwell.utils import bl_cache, sci_constants, sim_symbols
|
from blender_maxwell.utils import bl_cache, sci_constants, sim_symbols
|
||||||
from blender_maxwell.utils import sympy_extra as spux
|
from blender_maxwell.utils import sympy_extra as spux
|
||||||
|
from frozendict import frozendict
|
||||||
|
|
||||||
from .... import contracts as ct
|
from .... import contracts as ct
|
||||||
from .... import sockets
|
from .... import sockets
|
|
@ -1,3 +1,19 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# blender_maxwell
|
# blender_maxwell
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 blender_maxwell Project Contributors
|
||||||
#
|
#
|
||||||
|
@ -22,7 +38,6 @@ from fractions import Fraction
|
||||||
|
|
||||||
import bpy
|
import bpy
|
||||||
import sympy as sp
|
import sympy as sp
|
||||||
|
|
||||||
from blender_maxwell.utils import bl_cache, logger, sim_symbols
|
from blender_maxwell.utils import bl_cache, logger, sim_symbols
|
||||||
from blender_maxwell.utils import sympy_extra as spux
|
from blender_maxwell.utils import sympy_extra as spux
|
||||||
|
|
|
@ -1,3 +1,19 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# blender_maxwell
|
# blender_maxwell
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 blender_maxwell Project Contributors
|
||||||
#
|
#
|
|
@ -1,3 +1,19 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# blender_maxwell
|
# blender_maxwell
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 blender_maxwell Project Contributors
|
||||||
#
|
#
|
||||||
|
@ -23,7 +39,6 @@ from pathlib import Path
|
||||||
import bpy
|
import bpy
|
||||||
import sympy as sp
|
import sympy as sp
|
||||||
import tidy3d as td
|
import tidy3d as td
|
||||||
|
|
||||||
from blender_maxwell.utils import bl_cache, logger, sim_symbols
|
from blender_maxwell.utils import bl_cache, logger, sim_symbols
|
||||||
from blender_maxwell.utils import sympy_extra as spux
|
from blender_maxwell.utils import sympy_extra as spux
|
||||||
|
|
|
@ -1,3 +1,19 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# blender_maxwell
|
# blender_maxwell
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 blender_maxwell Project Contributors
|
||||||
#
|
#
|
||||||
|
@ -21,7 +37,6 @@ from pathlib import Path
|
||||||
|
|
||||||
import bpy
|
import bpy
|
||||||
import tidy3d as td
|
import tidy3d as td
|
||||||
|
|
||||||
from blender_maxwell.utils import bl_cache, logger
|
from blender_maxwell.utils import bl_cache, logger
|
||||||
|
|
||||||
from .... import contracts as ct
|
from .... import contracts as ct
|
|
@ -1,3 +1,19 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# blender_maxwell
|
# blender_maxwell
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 blender_maxwell Project Contributors
|
||||||
#
|
#
|
||||||
|
@ -21,7 +37,6 @@ import typing as typ
|
||||||
import bpy
|
import bpy
|
||||||
import sympy as sp
|
import sympy as sp
|
||||||
import sympy.physics.units as spu
|
import sympy.physics.units as spu
|
||||||
|
|
||||||
from blender_maxwell.utils import bl_cache, logger
|
from blender_maxwell.utils import bl_cache, logger
|
||||||
from blender_maxwell.utils import sympy_extra as spux
|
from blender_maxwell.utils import sympy_extra as spux
|
||||||
|
|
||||||
|
@ -130,7 +145,8 @@ def update_scene_node_after_frame_changed(
|
||||||
for node_tree in [
|
for node_tree in [
|
||||||
_node_tree
|
_node_tree
|
||||||
for _node_tree in bpy.data.node_groups
|
for _node_tree in bpy.data.node_groups
|
||||||
if _node_tree.bl_idname == ct.TreeType.MaxwellSim.value and _node_tree.is_active
|
if _node_tree.bl_idname == ct.NodeTreeType.MaxwellSim.value
|
||||||
|
and _node_tree.is_active
|
||||||
]:
|
]:
|
||||||
for node in [
|
for node in [
|
||||||
_node
|
_node
|
|
@ -1,3 +1,19 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# blender_maxwell
|
# blender_maxwell
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 blender_maxwell Project Contributors
|
||||||
#
|
#
|
|
@ -1,3 +1,19 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# blender_maxwell
|
# blender_maxwell
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 blender_maxwell Project Contributors
|
||||||
#
|
#
|
|
@ -1,3 +1,19 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# blender_maxwell
|
# blender_maxwell
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 blender_maxwell Project Contributors
|
||||||
#
|
#
|
||||||
|
@ -20,7 +36,6 @@ import typing as typ
|
||||||
|
|
||||||
import bpy
|
import bpy
|
||||||
import tidy3d as td
|
import tidy3d as td
|
||||||
|
|
||||||
from blender_maxwell.services import tdcloud
|
from blender_maxwell.services import tdcloud
|
||||||
from blender_maxwell.utils import bl_cache, logger, sim_symbols
|
from blender_maxwell.utils import bl_cache, logger, sim_symbols
|
||||||
from blender_maxwell.utils import sympy_extra as spux
|
from blender_maxwell.utils import sympy_extra as spux
|
|
@ -1,3 +1,19 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# blender_maxwell
|
# blender_maxwell
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 blender_maxwell Project Contributors
|
||||||
#
|
#
|
|
@ -1,3 +1,19 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# blender_maxwell
|
# blender_maxwell
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 blender_maxwell Project Contributors
|
||||||
#
|
#
|
|
@ -1,3 +1,19 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# blender_maxwell
|
# blender_maxwell
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 blender_maxwell Project Contributors
|
||||||
#
|
#
|
|
@ -1,3 +1,19 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# blender_maxwell
|
# blender_maxwell
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 blender_maxwell Project Contributors
|
||||||
#
|
#
|
|
@ -1,3 +1,19 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# blender_maxwell
|
# blender_maxwell
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 blender_maxwell Project Contributors
|
||||||
#
|
#
|
|
@ -1,3 +1,19 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# blender_maxwell
|
# blender_maxwell
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 blender_maxwell Project Contributors
|
||||||
#
|
#
|
|
@ -1,3 +1,19 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# blender_maxwell
|
# blender_maxwell
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 blender_maxwell Project Contributors
|
||||||
#
|
#
|
||||||
|
@ -24,11 +40,10 @@ import bpy
|
||||||
import sympy as sp
|
import sympy as sp
|
||||||
import sympy.physics.units as spu
|
import sympy.physics.units as spu
|
||||||
import tidy3d as td
|
import tidy3d as td
|
||||||
from tidy3d.material_library.material_library import MaterialItem as Tidy3DMediumItem
|
|
||||||
from tidy3d.material_library.material_library import VariantItem as Tidy3DMediumVariant
|
|
||||||
|
|
||||||
from blender_maxwell.utils import bl_cache, logger, sci_constants
|
from blender_maxwell.utils import bl_cache, logger, sci_constants
|
||||||
from blender_maxwell.utils import sympy_extra as spux
|
from blender_maxwell.utils import sympy_extra as spux
|
||||||
|
from tidy3d.material_library.material_library import MaterialItem as Tidy3DMediumItem
|
||||||
|
from tidy3d.material_library.material_library import VariantItem as Tidy3DMediumVariant
|
||||||
|
|
||||||
from ... import contracts as ct
|
from ... import contracts as ct
|
||||||
from ... import managed_objs, sockets
|
from ... import managed_objs, sockets
|
|
@ -1,3 +1,19 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# blender_maxwell
|
# blender_maxwell
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 blender_maxwell Project Contributors
|
||||||
#
|
#
|
|
@ -1,3 +1,19 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# blender_maxwell
|
# blender_maxwell
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 blender_maxwell Project Contributors
|
||||||
#
|
#
|
||||||
|
@ -20,7 +36,6 @@ import functools
|
||||||
import typing as typ
|
import typing as typ
|
||||||
|
|
||||||
import tidy3d as td
|
import tidy3d as td
|
||||||
|
|
||||||
from blender_maxwell.utils import logger
|
from blender_maxwell.utils import logger
|
||||||
from blender_maxwell.utils import sympy_extra as spux
|
from blender_maxwell.utils import sympy_extra as spux
|
||||||
|
|
|
@ -1,3 +1,19 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# blender_maxwell
|
# blender_maxwell
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 blender_maxwell Project Contributors
|
||||||
#
|
#
|
||||||
|
@ -20,7 +36,6 @@ import typing as typ
|
||||||
|
|
||||||
import bpy
|
import bpy
|
||||||
import tidy3d as td
|
import tidy3d as td
|
||||||
|
|
||||||
from blender_maxwell.utils import logger
|
from blender_maxwell.utils import logger
|
||||||
from blender_maxwell.utils import sympy_extra as spux
|
from blender_maxwell.utils import sympy_extra as spux
|
||||||
|
|
|
@ -1,3 +1,19 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# blender_maxwell
|
# blender_maxwell
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 blender_maxwell Project Contributors
|
||||||
#
|
#
|
||||||
|
@ -20,7 +36,6 @@ import typing as typ
|
||||||
|
|
||||||
import bpy
|
import bpy
|
||||||
import tidy3d as td
|
import tidy3d as td
|
||||||
|
|
||||||
from blender_maxwell.utils import logger
|
from blender_maxwell.utils import logger
|
||||||
from blender_maxwell.utils import sympy_extra as spux
|
from blender_maxwell.utils import sympy_extra as spux
|
||||||
|
|
|
@ -1,3 +1,19 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# blender_maxwell
|
# blender_maxwell
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 blender_maxwell Project Contributors
|
||||||
#
|
#
|
|
@ -1,3 +1,19 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# blender_maxwell
|
# blender_maxwell
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 blender_maxwell Project Contributors
|
||||||
#
|
#
|
|
@ -1,3 +1,19 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# blender_maxwell
|
# blender_maxwell
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 blender_maxwell Project Contributors
|
||||||
#
|
#
|
||||||
|
@ -20,7 +36,6 @@ import bpy
|
||||||
import sympy.physics.units as spu
|
import sympy.physics.units as spu
|
||||||
import tidy3d as td
|
import tidy3d as td
|
||||||
import tidy3d.plugins.dispersion as td_dispersion
|
import tidy3d.plugins.dispersion as td_dispersion
|
||||||
|
|
||||||
from blender_maxwell.utils import bl_cache, logger
|
from blender_maxwell.utils import bl_cache, logger
|
||||||
from blender_maxwell.utils import sympy_extra as spux
|
from blender_maxwell.utils import sympy_extra as spux
|
||||||
|
|
|
@ -1,3 +1,19 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# blender_maxwell
|
# blender_maxwell
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 blender_maxwell Project Contributors
|
||||||
#
|
#
|
|
@ -1,3 +1,19 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# blender_maxwell
|
# blender_maxwell
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 blender_maxwell Project Contributors
|
||||||
#
|
#
|
|
@ -1,3 +1,19 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# blender_maxwell
|
# blender_maxwell
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 blender_maxwell Project Contributors
|
||||||
#
|
#
|
|
@ -1,3 +1,19 @@
|
||||||
|
# oscillode
|
||||||
|
# Copyright (C) 2024 oscillode Project Contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# blender_maxwell
|
# blender_maxwell
|
||||||
# Copyright (C) 2024 blender_maxwell Project Contributors
|
# Copyright (C) 2024 blender_maxwell Project Contributors
|
||||||
#
|
#
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue