From 20c9e6f902e6529d585dbc42adfb12dd0457490b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sofus=20Albert=20H=C3=B8gsbro=20Rose?= Date: Sun, 5 May 2024 14:26:09 +0200 Subject: [PATCH] fix: fixed bugs preventing end-to-end sim Several bugs/gotchas/papercuts have been fixed, which together made it really hard Closes #47, #48, #49, #50, #51, #52. --- .../assets/examples/sio_waveguide.blend | 3 ++ .../internal/monitor/_monitor_eh_field.blend | 4 +- .../monitor/_monitor_power_flux.blend | 4 +- .../simulation/_simulation_sim_domain.blend | 4 +- .../structure/_structure_primitive_box.blend | 4 +- .../structure/_structure_primitive_ring.blend | 4 +- .../_structure_primitive_sphere.blend | 2 +- src/blender_maxwell/contracts/addon.py | 6 +-- .../contracts/bl_socket_types.py | 2 +- .../contracts/flow_kinds/flow_kinds.py | 3 +- .../contracts/flow_kinds/lazy_array_range.py | 24 ++++++++--- .../managed_objs/managed_bl_modifier.py | 12 ++++-- .../maxwell_sim_nodes/nodes/analysis/viz.py | 7 ++-- .../maxwell_sim_nodes/nodes/base.py | 11 ++++- .../inputs/web_importers/tidy3d_web_runner.py | 11 +---- .../nodes/monitors/eh_field_monitor.py | 42 +++++++++++++++++++ .../monitors/field_power_flux_monitor.py | 2 +- .../web_exporters/tidy3d_web_exporter.py | 9 ++-- .../maxwell_sim_nodes/sockets/base.py | 10 +++++ .../maxwell_sim_nodes/sockets/expr.py | 2 +- src/blender_maxwell/preferences.py | 17 ++++++++ src/scripts/bl_install_addon.py | 12 +++++- src/scripts/info.py | 1 + 23 files changed, 148 insertions(+), 48 deletions(-) create mode 100644 src/blender_maxwell/assets/examples/sio_waveguide.blend diff --git a/src/blender_maxwell/assets/examples/sio_waveguide.blend b/src/blender_maxwell/assets/examples/sio_waveguide.blend new file mode 100644 index 0000000..780f283 --- /dev/null +++ b/src/blender_maxwell/assets/examples/sio_waveguide.blend @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:afcfad180fea9482c55035b6a40655c676f1f47b6efd1e3d85adffba7ffcfeba +size 3761776 diff --git a/src/blender_maxwell/assets/internal/monitor/_monitor_eh_field.blend b/src/blender_maxwell/assets/internal/monitor/_monitor_eh_field.blend index fe5e702..087ca07 100644 --- a/src/blender_maxwell/assets/internal/monitor/_monitor_eh_field.blend +++ b/src/blender_maxwell/assets/internal/monitor/_monitor_eh_field.blend @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a7459adc5923562dc295a5ee65b662d3bd26abb7e75c6612a48ee8db9d30fe68 -size 874743 +oid sha256:d4d441cf4e78cdd4050445a757b52e600b4f67269300c0c7f352c53be2a7ca2d +size 874751 diff --git a/src/blender_maxwell/assets/internal/monitor/_monitor_power_flux.blend b/src/blender_maxwell/assets/internal/monitor/_monitor_power_flux.blend index d56803c..d0fd475 100644 --- a/src/blender_maxwell/assets/internal/monitor/_monitor_power_flux.blend +++ b/src/blender_maxwell/assets/internal/monitor/_monitor_power_flux.blend @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1a094ffdb6957422942c7b7452fa4873986a7897a23ebf4b2fa33c09419b940b -size 870760 +oid sha256:ac078f3aa6a67347ed92d92bfc976b67e137f7d478eaa326009c9370513488be +size 902805 diff --git a/src/blender_maxwell/assets/internal/simulation/_simulation_sim_domain.blend b/src/blender_maxwell/assets/internal/simulation/_simulation_sim_domain.blend index e202dba..3ec283d 100644 --- a/src/blender_maxwell/assets/internal/simulation/_simulation_sim_domain.blend +++ b/src/blender_maxwell/assets/internal/simulation/_simulation_sim_domain.blend @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5a989ca283df0b9be0dc0c3005d3be13335b0b54968d87209562ae2ac97993ff -size 805812 +oid sha256:3053143b43777d93ddd0d155d8f49ed3423d497b832c183b44d2cd8c446ec521 +size 805948 diff --git a/src/blender_maxwell/assets/internal/structure/_structure_primitive_box.blend b/src/blender_maxwell/assets/internal/structure/_structure_primitive_box.blend index 25c9a63..2a71d67 100644 --- a/src/blender_maxwell/assets/internal/structure/_structure_primitive_box.blend +++ b/src/blender_maxwell/assets/internal/structure/_structure_primitive_box.blend @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:189773c90bec67c272cf9270e096c0b19ad41f57f829f616e44a388f35680d7a -size 855469 +oid sha256:93bc80c604e75cd0efd5cfcc5f31492e9f45c6b25e68c26db9f309c47a649238 +size 855477 diff --git a/src/blender_maxwell/assets/internal/structure/_structure_primitive_ring.blend b/src/blender_maxwell/assets/internal/structure/_structure_primitive_ring.blend index 17b6db9..ed57c12 100644 --- a/src/blender_maxwell/assets/internal/structure/_structure_primitive_ring.blend +++ b/src/blender_maxwell/assets/internal/structure/_structure_primitive_ring.blend @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:975894c7674df55f0bafffd1986180b36e79b1f5584ab8db10b93e01c3a0b235 -size 883891 +oid sha256:87051b6614bdb1adde169781c959b1eb2ffea14fbbc38536c9c4a74545665e39 +size 883827 diff --git a/src/blender_maxwell/assets/internal/structure/_structure_primitive_sphere.blend b/src/blender_maxwell/assets/internal/structure/_structure_primitive_sphere.blend index b29aca9..5b42966 100644 --- a/src/blender_maxwell/assets/internal/structure/_structure_primitive_sphere.blend +++ b/src/blender_maxwell/assets/internal/structure/_structure_primitive_sphere.blend @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ee2fbe2560a62f9d1d5c331cd284bdd11d970c40fe923c770326b40adab4749e +oid sha256:ad754571aeaebf8884ea97bf15334b733bb50cb8e6f8c44167b27435cddca44d size 853546 diff --git a/src/blender_maxwell/contracts/addon.py b/src/blender_maxwell/contracts/addon.py index 2042921..e987285 100644 --- a/src/blender_maxwell/contracts/addon.py +++ b/src/blender_maxwell/contracts/addon.py @@ -48,10 +48,10 @@ ORIGINAL_SYS_PATH = sys.path.copy() #################### # - Local Addon Cache #################### -ADDON_CACHE = PATH_ADDON_ROOT / '.addon_cache' -ADDON_CACHE.mkdir(exist_ok=True) +DEFAULT_ADDON_CACHE = PATH_ADDON_ROOT / '.addon_cache' +DEFAULT_ADDON_CACHE.mkdir(exist_ok=True) -PIP_INSTALL_LOG = ADDON_CACHE / 'pip_install.log' +PIP_INSTALL_LOG = DEFAULT_ADDON_CACHE / 'pip_install.log' #################### diff --git a/src/blender_maxwell/node_trees/maxwell_sim_nodes/contracts/bl_socket_types.py b/src/blender_maxwell/node_trees/maxwell_sim_nodes/contracts/bl_socket_types.py index 19cf02e..4097443 100644 --- a/src/blender_maxwell/node_trees/maxwell_sim_nodes/contracts/bl_socket_types.py +++ b/src/blender_maxwell/node_trees/maxwell_sim_nodes/contracts/bl_socket_types.py @@ -133,7 +133,7 @@ class BLSocketType(enum.StrEnum): return { # Blender # Basic - BLST.Bool: ST.String, + BLST.Bool: ST.Bool, # Float # Array-Like BLST.Color: ST.Color, diff --git a/src/blender_maxwell/node_trees/maxwell_sim_nodes/contracts/flow_kinds/flow_kinds.py b/src/blender_maxwell/node_trees/maxwell_sim_nodes/contracts/flow_kinds/flow_kinds.py index 02feaa8..e713bd7 100644 --- a/src/blender_maxwell/node_trees/maxwell_sim_nodes/contracts/flow_kinds/flow_kinds.py +++ b/src/blender_maxwell/node_trees/maxwell_sim_nodes/contracts/flow_kinds/flow_kinds.py @@ -69,7 +69,8 @@ class FlowKind(enum.StrEnum): flow_obj, unit_system: spux.UnitSystem, ): - log.debug('%s: Scaling "%s" to Unit System', kind, str(flow_obj)) + # log.debug('%s: Scaling "%s" to Unit System', kind, str(flow_obj)) + ## TODO: Use a hot-path logger. if kind == FlowKind.Value: return spux.scale_to_unit_system( flow_obj, diff --git a/src/blender_maxwell/node_trees/maxwell_sim_nodes/contracts/flow_kinds/lazy_array_range.py b/src/blender_maxwell/node_trees/maxwell_sim_nodes/contracts/flow_kinds/lazy_array_range.py index df26993..c88ca2a 100644 --- a/src/blender_maxwell/node_trees/maxwell_sim_nodes/contracts/flow_kinds/lazy_array_range.py +++ b/src/blender_maxwell/node_trees/maxwell_sim_nodes/contracts/flow_kinds/lazy_array_range.py @@ -352,6 +352,22 @@ class LazyArrayRangeFlow: #################### # - Realization #################### + def realize_start( + self, + symbol_values: dict[spux.Symbol, typ.Any] = MappingProxyType({}), + ) -> ArrayFlow | LazyValueFuncFlow: + return spux.sympy_to_python( + self.start.subs({sym: symbol_values[sym.name] for sym in self.symbols}) + ) + + def realize_stop( + self, + symbol_values: dict[spux.Symbol, typ.Any] = MappingProxyType({}), + ) -> ArrayFlow | LazyValueFuncFlow: + return spux.sympy_to_python( + self.stop.subs({sym: symbol_values[sym.name] for sym in self.symbols}) + ) + def realize( self, symbol_values: dict[spux.Symbol, typ.Any] = MappingProxyType({}), @@ -377,12 +393,8 @@ class LazyArrayRangeFlow: raise ValueError(msg) # Realize Symbols - realized_start = spux.sympy_to_python( - self.start.subs({sym: symbol_values[sym.name] for sym in self.symbols}) - ) - realized_stop = spux.sympy_to_python( - self.stop.subs({sym: symbol_values[sym.name] for sym in self.symbols}) - ) + realized_start = self.realize_start(symbol_values) + realized_stop = self.realize_stop(symbol_values) # Return Linspace / Logspace def gen_array() -> jtyp.Inexact[jtyp.Array, ' steps']: diff --git a/src/blender_maxwell/node_trees/maxwell_sim_nodes/managed_objs/managed_bl_modifier.py b/src/blender_maxwell/node_trees/maxwell_sim_nodes/managed_objs/managed_bl_modifier.py index 8d79ae1..481dd1d 100644 --- a/src/blender_maxwell/node_trees/maxwell_sim_nodes/managed_objs/managed_bl_modifier.py +++ b/src/blender_maxwell/node_trees/maxwell_sim_nodes/managed_objs/managed_bl_modifier.py @@ -110,9 +110,15 @@ def write_modifier_geonodes( for socket_name in modifier_attrs['inputs']: iface_id = socket_infos[socket_name].bl_isocket_identifier - bl_modifier[iface_id] = spux.scale_to_unit_system( - modifier_attrs['inputs'][socket_name], modifier_attrs['unit_system'] - ) + input_value = modifier_attrs['inputs'][socket_name] + + if isinstance(input_value, spux.SympyType): + bl_modifier[iface_id] = spux.scale_to_unit_system( + input_value, modifier_attrs['unit_system'] + ) + else: + bl_modifier[iface_id] = input_value + modifier_altered = True ## TODO: More fine-grained alterations diff --git a/src/blender_maxwell/node_trees/maxwell_sim_nodes/nodes/analysis/viz.py b/src/blender_maxwell/node_trees/maxwell_sim_nodes/nodes/analysis/viz.py index dfc3e41..c932da1 100644 --- a/src/blender_maxwell/node_trees/maxwell_sim_nodes/nodes/analysis/viz.py +++ b/src/blender_maxwell/node_trees/maxwell_sim_nodes/nodes/analysis/viz.py @@ -164,7 +164,6 @@ class VizTarget(enum.StrEnum): @staticmethod def valid_targets_for(viz_mode: VizMode) -> list[typ.Self] | None: return { - None: [], VizMode.Hist1D: [VizTarget.Plot2D], VizMode.BoxPlot1D: [VizTarget.Plot2D], VizMode.Curve2D: [VizTarget.Plot2D], @@ -227,7 +226,7 @@ class VizNode(base.MaxwellSimNode): ## - Properties ##################### viz_mode: enum.Enum = bl_cache.BLField( - prop_ui=True, enum_cb=lambda self, _: self.search_modes() + prop_ui=True, enum_cb=lambda self, _: self.search_viz_modes() ) viz_target: enum.Enum = bl_cache.BLField( prop_ui=True, enum_cb=lambda self, _: self.search_targets() @@ -249,8 +248,8 @@ class VizNode(base.MaxwellSimNode): return None - def search_modes(self) -> list[ct.BLEnumElement]: - if not ct.FlowSignal.check(self.data_info): + def search_viz_modes(self) -> list[ct.BLEnumElement]: + if self.data_info is not None: return [ ( viz_mode, diff --git a/src/blender_maxwell/node_trees/maxwell_sim_nodes/nodes/base.py b/src/blender_maxwell/node_trees/maxwell_sim_nodes/nodes/base.py index ada987d..9f51403 100644 --- a/src/blender_maxwell/node_trees/maxwell_sim_nodes/nodes/base.py +++ b/src/blender_maxwell/node_trees/maxwell_sim_nodes/nodes/base.py @@ -261,17 +261,24 @@ class MaxwellSimNode(bpy.types.Node): #################### @events.on_value_changed( prop_name='sim_node_name', + props={'sim_node_name'}, stop_propagation=True, ) - def _on_sim_node_name_changed(self): + def _on_sim_node_name_changed(self, props): log.info( 'Changed Sim Node Name of a "%s" to "%s" (self=%s)', self.bl_idname, - self.sim_node_name, + props['sim_node_name'], str(self), ) # Set Name of Managed Objects + for mobj in self.managed_objs.values(): + mobj.name = props['sim_node_name'] + + ## Invalidate Cache + ## -> Persistance doesn't happen if we simply mutate. + ## -> This ensures that the name change is picked up. self.managed_objs = bl_cache.Signal.InvalidateCache @events.on_value_changed(prop_name='active_socket_set') diff --git a/src/blender_maxwell/node_trees/maxwell_sim_nodes/nodes/inputs/web_importers/tidy3d_web_runner.py b/src/blender_maxwell/node_trees/maxwell_sim_nodes/nodes/inputs/web_importers/tidy3d_web_runner.py index 2f63596..b00fa02 100644 --- a/src/blender_maxwell/node_trees/maxwell_sim_nodes/nodes/inputs/web_importers/tidy3d_web_runner.py +++ b/src/blender_maxwell/node_trees/maxwell_sim_nodes/nodes/inputs/web_importers/tidy3d_web_runner.py @@ -80,7 +80,6 @@ class ReloadTrackedTask(bpy.types.Operator): def execute(self, context): node = context.node tdcloud.TidyCloudTasks.update_task(node.cloud_task) - node.sim_data = bl_cache.Signal.InvalidateCache return {'FINISHED'} @@ -137,7 +136,7 @@ class Tidy3DWebRunnerNode(base.MaxwellSimNode): return task_info - @bl_cache.cached_bl_property(persist=False) + @property def sim_data(self) -> td.Simulation | None: """Retrieve the simulation data of the current cloud task from the input socket. @@ -155,7 +154,7 @@ class Tidy3DWebRunnerNode(base.MaxwellSimNode): self.cloud_task, tdcloud.TidyCloudTasks.task_info( self.cloud_task.task_id - ).disk_cache_path(ct.addon.ADDON_CACHE), + ).disk_cache_path(ct.addon.prefs().addon_cache_path), ) if sim_data is None: return None @@ -250,12 +249,6 @@ class Tidy3DWebRunnerNode(base.MaxwellSimNode): #################### # - Output Methods #################### - @events.on_value_changed( - socket_name='Cloud Task', - ) - def compute_cloud_task(self) -> None: - self.sim_data = bl_cache.Signal.InvalidateCache - @events.computes_output_socket( 'Sim Data', props={'sim_data'}, diff --git a/src/blender_maxwell/node_trees/maxwell_sim_nodes/nodes/monitors/eh_field_monitor.py b/src/blender_maxwell/node_trees/maxwell_sim_nodes/nodes/monitors/eh_field_monitor.py index ee5d4da..83c904c 100644 --- a/src/blender_maxwell/node_trees/maxwell_sim_nodes/nodes/monitors/eh_field_monitor.py +++ b/src/blender_maxwell/node_trees/maxwell_sim_nodes/nodes/monitors/eh_field_monitor.py @@ -135,6 +135,48 @@ class EHFieldMonitorNode(base.MaxwellSimNode): freqs=input_sockets['Freqs'].realize().values, ) + @events.computes_output_socket( + 'Time Monitor', + props={'sim_node_name'}, + input_sockets={ + 'Center', + 'Size', + 'Spatial Subdivs', + 'Time Range', + 'Temporal Subdivs', + }, + input_socket_kinds={ + 'Time Range': ct.FlowKind.LazyArrayRange, + }, + unit_systems={'Tidy3DUnits': ct.UNITS_TIDY3D}, + scale_input_sockets={ + 'Center': 'Tidy3DUnits', + 'Size': 'Tidy3DUnits', + 'Time Range': 'Tidy3DUnits', + }, + ) + def compute_time_monitor( + self, + input_sockets: dict, + props: dict, + unit_systems: dict, + ) -> td.FieldMonitor: + log.info( + 'Computing FieldMonitor (name="%s") with center="%s", size="%s"', + props['sim_node_name'], + input_sockets['Center'], + input_sockets['Size'], + ) + return td.FieldTimeMonitor( + center=input_sockets['Center'], + size=input_sockets['Size'], + name=props['sim_node_name'], + interval_space=tuple(input_sockets['Spatial Subdivs']), + start=input_sockets['Time Range'].realize_start(), + stop=input_sockets['Time Range'].realize_stop(), + interval=input_sockets['Temporal Subdivs'], + ) + #################### # - Preview #################### diff --git a/src/blender_maxwell/node_trees/maxwell_sim_nodes/nodes/monitors/field_power_flux_monitor.py b/src/blender_maxwell/node_trees/maxwell_sim_nodes/nodes/monitors/field_power_flux_monitor.py index 7128f8a..3672309 100644 --- a/src/blender_maxwell/node_trees/maxwell_sim_nodes/nodes/monitors/field_power_flux_monitor.py +++ b/src/blender_maxwell/node_trees/maxwell_sim_nodes/nodes/monitors/field_power_flux_monitor.py @@ -132,7 +132,7 @@ class PowerFluxMonitorNode(base.MaxwellSimNode): size=input_sockets['Size'], name=props['sim_node_name'], interval_space=(1, 1, 1), - freqs=input_sockets['Freqs'].realize_array, + freqs=input_sockets['Freqs'].realize_array.values, normal_dir='+' if input_sockets['Direction'] else '-', ) diff --git a/src/blender_maxwell/node_trees/maxwell_sim_nodes/nodes/outputs/web_exporters/tidy3d_web_exporter.py b/src/blender_maxwell/node_trees/maxwell_sim_nodes/nodes/outputs/web_exporters/tidy3d_web_exporter.py index 6f45430..45f5782 100644 --- a/src/blender_maxwell/node_trees/maxwell_sim_nodes/nodes/outputs/web_exporters/tidy3d_web_exporter.py +++ b/src/blender_maxwell/node_trees/maxwell_sim_nodes/nodes/outputs/web_exporters/tidy3d_web_exporter.py @@ -190,7 +190,9 @@ class Tidy3DWebExporterNode(base.MaxwellSimNode): has_uploaded_task = self.uploaded_task_id != '' if has_uploaded_task: - return tdcloud.TidyCloudTasks.task(self.uploaded_task_id) + return tdcloud.TidyCloudTasks.tasks(self.new_cloud_task.cloud_folder).get( + self.uploaded_task_id + ) return None @property @@ -199,9 +201,8 @@ class Tidy3DWebExporterNode(base.MaxwellSimNode): If one can't be loaded, return None. """ - has_uploaded_task = self.uploaded_task_id != '' - - if has_uploaded_task: + uploaded_task = self.uploaded_task + if uploaded_task is not None: return tdcloud.TidyCloudTasks.task_info(self.uploaded_task_id) return None diff --git a/src/blender_maxwell/node_trees/maxwell_sim_nodes/sockets/base.py b/src/blender_maxwell/node_trees/maxwell_sim_nodes/sockets/base.py index a4c00f7..6d05d33 100644 --- a/src/blender_maxwell/node_trees/maxwell_sim_nodes/sockets/base.py +++ b/src/blender_maxwell/node_trees/maxwell_sim_nodes/sockets/base.py @@ -979,6 +979,16 @@ class MaxwellSimSocket(bpy.types.NodeSocket): col: Target for defining UI elements. """ + def draw_lazy_value_func(self, col: bpy.types.UILayout) -> None: + """Draws the socket lazy value function UI on its own line. + + Notes: + Should be overriden by individual socket classes, if they have an editable `FlowKind.LazyValueFunc`. + + Parameters: + col: Target for defining UI elements. + """ + #################### # - UI Methods: Auxilliary #################### diff --git a/src/blender_maxwell/node_trees/maxwell_sim_nodes/sockets/expr.py b/src/blender_maxwell/node_trees/maxwell_sim_nodes/sockets/expr.py index 996f63b..54d945a 100644 --- a/src/blender_maxwell/node_trees/maxwell_sim_nodes/sockets/expr.py +++ b/src/blender_maxwell/node_trees/maxwell_sim_nodes/sockets/expr.py @@ -225,7 +225,7 @@ class ExprBLSocket(base.MaxwellSimSocket): # Workaround: Manually Jiggle FlowKind Invalidation self.value = self.value - self.lazy_value_range = self.lazy_value_range + self.lazy_array_range = self.lazy_array_range #################### # - Property Callback diff --git a/src/blender_maxwell/preferences.py b/src/blender_maxwell/preferences.py index 6bdbefa..7d9793c 100644 --- a/src/blender_maxwell/preferences.py +++ b/src/blender_maxwell/preferences.py @@ -46,6 +46,23 @@ class BLMaxwellAddonPrefs(bpy.types.AddonPreferences): #################### # - Properties #################### + # Addon Cache Path + bl__addon_cache_path: bpy.props.StringProperty( + name='Addon Cache Path', + description='Path to Addon Cache', + subtype='FILE_PATH', + default=str(ct.addon.DEFAULT_ADDON_CACHE), + update=lambda self, _: self.on_addon_pydeps_changed(), + ) + + @property + def addon_cache_path(self) -> Path: + return Path(bpy.path.abspath(self.bl__addon_cache_path)) + + @addon_cache_path.setter + def addon_cache_path(self, path: Path) -> None: + self.bl__addon_cache_path = str(path.resolve()) + # PyDeps Default Path use_default_pydeps_path: bpy.props.BoolProperty( name='Use Default PyDeps Path', diff --git a/src/scripts/bl_install_addon.py b/src/scripts/bl_install_addon.py index 4682161..42199d5 100644 --- a/src/scripts/bl_install_addon.py +++ b/src/scripts/bl_install_addon.py @@ -68,12 +68,18 @@ def install_and_enable_addon(addon_name: str, addon_zip: Path) -> None: bpy.ops.wm.save_userpref() -def setup_for_development(addon_name: str, path_addon_dev_deps: Path) -> None: +def setup_for_development( + addon_name: str, + path_addon_dev_deps: Path, + path_addon_cache_path: Path | None = None, +) -> None: addon_prefs = bpy.context.preferences.addons[addon_name].preferences # PyDeps Path addon_prefs.use_default_pydeps_path = False addon_prefs.pydeps_path = path_addon_dev_deps + if path_addon_cache_path is not None: + addon_prefs.addon_cache_path = path_addon_cache_path # Save User Preferences bpy.ops.wm.save_userpref() @@ -92,7 +98,9 @@ if __name__ == '__main__': ) as path_zipped: install_and_enable_addon(info.ADDON_NAME, path_zipped) - setup_for_development(info.ADDON_NAME, info.PATH_ADDON_DEV_DEPS) + setup_for_development( + info.ADDON_NAME, info.PATH_ADDON_DEV_DEPS, info.PATH_ADDON_DEV_CACHE + ) bpy.ops.wm.quit_blender() sys.exit(info.STATUS_INSTALLED_ADDON) diff --git a/src/scripts/info.py b/src/scripts/info.py index a65b434..cdb62f7 100644 --- a/src/scripts/info.py +++ b/src/scripts/info.py @@ -77,4 +77,5 @@ BOOTSTRAP_LOG_LEVEL_FILENAME = '.bootstrap_log_level' PATH_ADDON_DEV_BLEND = PATH_DEV / 'demo.blend' PATH_ADDON_DEV_DEPS = PATH_DEV / '.cached-dev-dependencies' +PATH_ADDON_DEV_CACHE = PATH_DEV / '.dev-addon-cache' PATH_ADDON_DEV_DEPS.mkdir(exist_ok=True)