Skip to content

Commit

Permalink
Updated engon from monorepo commit 618d11b92726f0c7ab43a1e27ad18d2d2b…
Browse files Browse the repository at this point in the history
…0c61f8
  • Loading branch information
Griperis committed Dec 11, 2024
1 parent 3f5c622 commit 112681c
Show file tree
Hide file tree
Showing 38 changed files with 330 additions and 62 deletions.
14 changes: 7 additions & 7 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
from . import hatchery
from . import mapr

from . import ui_utils
from . import utils
from . import asset_registry
from . import asset_pack_installer
from . import pack_info_search_paths
Expand Down Expand Up @@ -132,12 +132,12 @@
bl_info = {
"name": "engon",
"author": "polygoniq xyz s.r.o.",
"version": (1, 4, 0), # bump doc_url and version in register as well!
"version": (1, 4, 1), # bump doc_url and version in register as well!
"blender": (3, 6, 0),
"location": "polygoniq tab in the sidebar of the 3D View window",
"description": "",
"description": "Browse assets, filter and sort, scatter, animate, adjust rigs",
"category": "Object",
"doc_url": "https://docs.polygoniq.com/engon/1.4.0/",
"doc_url": "https://docs.polygoniq.com/engon/1.4.1/",
"tracker_url": "https://polygoniq.com/discord/",
}

Expand All @@ -158,9 +158,9 @@ def _post_register():
def register():
# We pass mock "bl_info" to the updater, as from Blender 4.2.0, the "bl_info" is
# no longer available in this scope.
addon_updater_ops.register({"version": (1, 4, 0)})
addon_updater_ops.register({"version": (1, 4, 1)})

ui_utils.register()
utils.register()
pack_info_search_paths.register()
convert_selection.register()
panel.register()
Expand Down Expand Up @@ -196,7 +196,7 @@ def unregister():
panel.unregister()
convert_selection.unregister()
pack_info_search_paths.unregister()
ui_utils.unregister()
utils.unregister()

# Remove all nested modules from module cache, more reliable than importlib.reload(..)
# Idea by BD3D / Jacques Lucke
Expand Down
4 changes: 2 additions & 2 deletions blender_manifest.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
schema_version = "1.0.0"

id = "engon"
version = "1.4.0"
version = "1.4.1"
name = "engon"
tagline = "Browse assets, filter and sort, scatter, animate, adjust rigs"
maintainer = "polygoniq <[email protected]>"
type = "add-on"

website = "https://docs.polygoniq.com/engon/1.4.0/"
website = "https://docs.polygoniq.com/engon/1.4.1/"
tags = ["Add Mesh", "Animation", "Material", "Mesh", "Object", "Scene", "User Interface"]
blender_version_min = "4.2.0"

Expand Down
2 changes: 0 additions & 2 deletions browser/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
import typing
import logging
from . import filters
from . import previews
from . import utils
from .. import mapr
from .. import polib
from .. import asset_registry
Expand Down
6 changes: 6 additions & 0 deletions browser/spawn.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,9 +396,15 @@ def execute(self, context: bpy.types.Context):
for old_collection in obj.users_collection:
old_collection.objects.unlink(obj)
old_collection.objects.link(obj_copy)
obj_copy.parent = obj.parent
obj_copy.matrix_world = obj.matrix_world
obj_copy.select_set(True)

if prefs.spawn_options.make_editable:
polib.asset_pack_bpy.make_selection_editable(
context, True, keep_selection=True, keep_active=True
)

if prefs.spawn_options.remove_duplicates:
self._remove_duplicates()

Expand Down
3 changes: 0 additions & 3 deletions browser/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,8 @@
#
# ##### END GPL LICENSE BLOCK #####

import bpy
import logging
import typing
from .. import mapr
from .. import asset_registry

logger = logging.getLogger(f"polygoniq.{__name__}")

Expand Down
4 changes: 2 additions & 2 deletions features/aquatiq_material_limitation_warning.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import logging
from . import feature_utils
from . import asset_pack_panels
from .. import ui_utils
from .. import utils
from .. import polib

logger = logging.getLogger(f"polygoniq.{__name__}")
Expand Down Expand Up @@ -108,7 +108,7 @@ def draw_material_limitations(

layout.alert = True
op = layout.operator(
ui_utils.ShowPopup.bl_idname,
utils.show_popup.ShowPopup.bl_idname,
text=f"See {len(warnings)} warning{'s' if len(warnings) > 1 else ''}",
icon='ERROR',
)
Expand Down
1 change: 1 addition & 0 deletions features/aquatiq_paint_mask.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ class AquatiqPaintMaskPanel(feature_utils.EngonFeaturePanelMixin, bpy.types.Pane
bl_idname = "VIEW_3D_PT_engon_aquatiq_paint_mask"
bl_parent_id = asset_pack_panels.AquatiqPanel.bl_idname
bl_label = "Paint Mask"
bl_options = {'DEFAULT_CLOSED'}

feature_name = "aquatiq_paint_mask"

Expand Down
5 changes: 3 additions & 2 deletions features/botaniq_adjustments.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ class BotaniqAdjustmentsPanel(feature_utils.PropertyAssetFeatureControlPanelMixi
polib.custom_props_bpy.CustomPropertyNames.BQ_RANDOM_PER_LEAF,
polib.custom_props_bpy.CustomPropertyNames.BQ_SEASON_OFFSET,
}
bl_options = {'DEFAULT_CLOSED'}

@classmethod
def filter_adjustable_assets(
Expand Down Expand Up @@ -182,11 +183,11 @@ def draw_multiedit(
)

row = layout.row(align=True)
row.label(text="", icon='BRUSH_MIX')
row.label(text="", icon='FREEZE')
row.prop(
prefs,
"season_offset",
icon='BRUSH_MIX',
icon='FREEZE',
text=f"Season: {self.get_season_from_value(prefs.season_offset)}",
slider=True,
)
Expand Down
1 change: 1 addition & 0 deletions features/botaniq_animations/botaniq_animations.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ class AnimationsPanel(feature_utils.EngonAssetFeatureControlPanelMixin, bpy.type
bl_idname = "VIEW_3D_PT_engon_botaniq_animations"
bl_parent_id = asset_pack_panels.BotaniqPanel.bl_idname
bl_label = "Animations"
bl_options = {'DEFAULT_CLOSED'}

feature_name = "botaniq_animations"

Expand Down
1 change: 1 addition & 0 deletions features/colorize.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ class ColorizePanel(feature_utils.PropertyAssetFeatureControlPanelMixin, bpy.typ
polib.custom_props_bpy.CustomPropertyNames.PQ_PRIMARY_COLOR_FACTOR,
polib.custom_props_bpy.CustomPropertyNames.PQ_SECONDARY_COLOR_FACTOR,
}
bl_options = {'DEFAULT_CLOSED'}

@classmethod
def filter_adjustable_assets(
Expand Down
1 change: 1 addition & 0 deletions features/emergency_lights.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ class EmergencyLightsPanel(
bl_parent_id = asset_pack_panels.TraffiqPanel.bl_idname
bl_label = "Emergency Lights"
feature_name = "emergency_lights"
bl_options = {'DEFAULT_CLOSED'}

template = polib.node_utils_bpy.NodeSocketsDrawTemplate(
asset_helpers.TQ_EMERGENCY_LIGHTS_NODE_GROUP_NAME, filter_=lambda _: True
Expand Down
1 change: 0 additions & 1 deletion features/feature_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import bpy
import itertools
import random
import sys
from .. import polib
from .. import asset_registry
from .. import asset_helpers
Expand Down
72 changes: 71 additions & 1 deletion features/license_plates_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@
import logging
from . import feature_utils
from . import asset_pack_panels
from .. import polib
from .. import asset_helpers
from .. import polib
from .. import utils

logger = logging.getLogger(f"polygoniq.{__name__}")

Expand All @@ -37,6 +38,20 @@
BACK_PLATE_PARENT_NAME_SUFFIX = "_License-Plate_B"


def get_license_plate_modifier(obj: bpy.types.Object) -> typing.Optional[bpy.types.NodesModifier]:
mods = polib.geonodes_mod_utils_bpy.get_geometry_nodes_modifiers_by_node_group(
obj,
asset_helpers.TQ_LICENSE_PLATE_NODE_GROUP_NAME_PREFIX,
)
if len(mods) == 0:
return None
elif len(mods) == 1:
return mods[0]
else:
logger.warning(f"Multiple license plate modifiers found on object '{obj.name}'!")
return mods[0]


@feature_utils.register_feature
class LicensePlatesGeneratorPanelMixin(feature_utils.GeonodesAssetFeatureControlPanelMixin):
feature_name = "license_plates_generator"
Expand All @@ -52,6 +67,7 @@ class LicensePlatesGeneratorPanel(
bl_idname = "VIEW_3D_PT_engon_license_plates_generator"
bl_parent_id = asset_pack_panels.TraffiqPanel.bl_idname
bl_label = "License Plates"
bl_options = {'DEFAULT_CLOSED'}

def draw_header(self, context: bpy.types.Context) -> None:
self.layout.label(text="", icon='EVENT_L')
Expand Down Expand Up @@ -125,6 +141,33 @@ class FrontPlatePanel(
obj.parent.name
).endswith(FRONT_PLATE_PARENT_NAME_SUFFIX)

def draw(self, context: bpy.types.Context) -> None:
if context.active_object is None:
return

decomposed_car = polib.asset_pack_bpy.decompose_traffiq_vehicle(context.active_object)
if decomposed_car is None:
return

front_plate = decomposed_car.front_plate
back_plate = decomposed_car.back_plate
assert front_plate is not None
if back_plate is not None:
op = self.layout.operator(
utils.copy_nodes_mod_values.CopyGeonodesModifierValues.bl_idname,
text="Copy To Back",
icon='PASTEDOWN',
)
op.src_name = front_plate.name
op.dst_name = back_plate.name
# The license plates modifiers are always at index 0. This operator won't be drawn
# in the UI if there is not back plate and front plate.
op.src_mod_idx = 0
op.dst_mod_idx = 0

self.layout.separator()
super().draw(context)


MODULE_CLASSES.append(FrontPlatePanel)

Expand All @@ -140,6 +183,33 @@ class BackPlatePanel(
obj.parent.name
).endswith(BACK_PLATE_PARENT_NAME_SUFFIX)

def draw(self, context: bpy.types.Context) -> None:
if context.active_object is None:
return

decomposed_car = polib.asset_pack_bpy.decompose_traffiq_vehicle(context.active_object)
if decomposed_car is None:
return

front_plate = decomposed_car.front_plate
back_plate = decomposed_car.back_plate
assert back_plate is not None
if front_plate is not None:
op = self.layout.operator(
utils.copy_nodes_mod_values.CopyGeonodesModifierValues.bl_idname,
text="Copy To Front",
icon='PASTEDOWN',
)
op.src_name = back_plate.name
op.dst_name = front_plate.name
# The license plates modifiers are always at index 0. This operator won't be drawn
# in the UI if there is not back plate and front plate.
op.src_mod_idx = 0
op.dst_mod_idx = 0

self.layout.separator()
super().draw(context)


MODULE_CLASSES.append(BackPlatePanel)

Expand Down
1 change: 1 addition & 0 deletions features/light_adjustments.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ class LightAdjustmentsPanel(feature_utils.PropertyAssetFeatureControlPanelMixin,
polib.custom_props_bpy.CustomPropertyNames.PQ_LIGHT_RGB,
polib.custom_props_bpy.CustomPropertyNames.PQ_LIGHT_STRENGTH,
}
bl_options = {'DEFAULT_CLOSED'}

@classmethod
def filter_adjustable_assets(
Expand Down
1 change: 1 addition & 0 deletions features/puddles.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ class PuddlesPanel(feature_utils.EngonFeaturePanelMixin, bpy.types.Panel):
bl_idname = "VIEW_3D_PT_engon_puddles"
bl_parent_id = asset_pack_panels.AquatiqPanel.bl_idname
bl_label = "Puddles"
bl_options = {'DEFAULT_CLOSED'}

feature_name = "puddles"

Expand Down
1 change: 1 addition & 0 deletions features/rain_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class RainGeneratorPanel(RainGeneratorPanelMixin, bpy.types.Panel):
bl_idname = "VIEW_3D_PT_aquatiq_rain_generator"
bl_parent_id = asset_pack_panels.AquatiqPanel.bl_idname
bl_label = "Rain Generator"
bl_options = {'DEFAULT_CLOSED'}

def draw_header(self, context: bpy.types.Context) -> None:
self.layout.label(text="", icon='OUTLINER_DATA_LIGHTPROBE')
Expand Down
1 change: 1 addition & 0 deletions features/river_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class RiverGeneratorPanel(RiverGeneratorPanelMixin, bpy.types.Panel):
bl_idname = "VIEW_3D_PT_aquatiq_river_generator"
bl_parent_id = asset_pack_panels.AquatiqPanel.bl_idname
bl_label = "River Generator"
bl_options = {'DEFAULT_CLOSED'}

def draw_header(self, context: bpy.types.Context) -> None:
self.layout.label(text="", icon='FORCE_FORCE')
Expand Down
1 change: 0 additions & 1 deletion features/road_generator/build_roads_modal.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

import bpy
import os
import traceback
import typing
import mathutils
import bpy_extras.view3d_utils
Expand Down
1 change: 1 addition & 0 deletions features/road_generator/panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ class RoadGeneratorPanel(RoadGeneratorPanelMixin, bpy.types.Panel):
bl_idname = "VIEW_3D_PT_engon_build_roads_modal"
bl_label = "Road Generator (Beta)"
bl_parent_id = asset_pack_panels.TraffiqPanel.bl_idname
bl_options = {'DEFAULT_CLOSED'}

def draw_header(self, context: bpy.types.Context):
self.layout.label(text="", icon='MOD_SIMPLEDEFORM')
Expand Down
1 change: 1 addition & 0 deletions features/traffiq_lights_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ class TraffiqLightsSettingsPanel(
bl_label = "Lights Settings"
feature_name = "traffiq_lights_settings"
related_custom_properties = {polib.custom_props_bpy.CustomPropertyNames.TQ_LIGHTS}
bl_options = {'DEFAULT_CLOSED'}

@classmethod
def find_unique_lights_containers_with_roots(
Expand Down
1 change: 1 addition & 0 deletions features/traffiq_paint_adjustments.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ class TraffiqPaintAdjustmentsPanel(
polib.custom_props_bpy.CustomPropertyNames.TQ_FLAKES_AMOUNT,
polib.custom_props_bpy.CustomPropertyNames.TQ_CLEARCOAT,
}
bl_options = {'DEFAULT_CLOSED'}

@classmethod
def filter_adjustable_assets(
Expand Down
1 change: 1 addition & 0 deletions features/traffiq_rigs.py
Original file line number Diff line number Diff line change
Expand Up @@ -947,6 +947,7 @@ class TraffiqRigsPanel(bpy.types.Panel, feature_utils.PropertyAssetFeatureContro
polib.custom_props_bpy.CustomPropertyNames.TQ_WHEELS_Y_ROLLING,
polib.custom_props_bpy.CustomPropertyNames.TQ_CAR_RIG,
}
bl_options = {'DEFAULT_CLOSED'}

@classmethod
def filter_adjustable_assets(
Expand Down
1 change: 1 addition & 0 deletions features/traffiq_wear.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ class TraffiqWearAdjustmentsPanel(
polib.custom_props_bpy.CustomPropertyNames.TQ_SCRATCHES,
polib.custom_props_bpy.CustomPropertyNames.TQ_BUMPS,
}
bl_options = {'DEFAULT_CLOSED'}

@classmethod
def filter_adjustable_assets(
Expand Down
1 change: 1 addition & 0 deletions features/vegetation_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class VegetationGeneratorPanel(
bl_idname = "VIEW_3D_PT_engon_vegetation_generator"
bl_parent_id = asset_pack_panels.BotaniqPanel.bl_idname
bl_label = "Vegetation Generator"
bl_options = {'DEFAULT_CLOSED'}

template = polib.node_utils_bpy.NodeSocketsDrawTemplate(
asset_helpers.BQ_CURVES_GENERATOR_NODE_GROUP_NAME,
Expand Down
1 change: 1 addition & 0 deletions features/vine_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class VineGeneratorPanel(
bl_idname = "VIEW_3D_PT_botaniq_vine_generator"
bl_parent_id = asset_pack_panels.BotaniqPanel.bl_idname
bl_label = "Vine Generator"
bl_options = {'DEFAULT_CLOSED'}

def draw_header(self, context: bpy.types.Context) -> None:
self.layout.label(text="", icon="GRAPH")
Expand Down
1 change: 0 additions & 1 deletion materialiq/displacement.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import logging
from .. import polib
from .. import hatchery
from .. import asset_helpers

logger = logging.getLogger(f"polygoniq.{__name__}")

Expand Down
1 change: 1 addition & 0 deletions materialiq/panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ class ToolsPanel(MaterialiqPanelMixin, bpy.types.Panel):
bl_idname = "VIEW_3D_PT_engon_materialiq_tools"
bl_parent_id = MaterialiqPanel.bl_idname
bl_label = "Tools"
bl_options = {'DEFAULT_CLOSED'}

def draw_header(self, context: bpy.types.Context) -> None:
self.layout.label(text="", icon='TOOL_SETTINGS')
Expand Down
Loading

0 comments on commit 112681c

Please sign in to comment.