Skip to content

Commit

Permalink
Added Vignette to the Assets
Browse files Browse the repository at this point in the history
  • Loading branch information
Aspirata committed Nov 10, 2024
1 parent 4f15d4c commit 62c1a7f
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 4 deletions.
36 changes: 36 additions & 0 deletions MiBlend_Source/Assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ def append_asset(asset_data):
elif asset_type == "Script":
run_python_script(asset_name, asset_path)

elif asset_type == "Compositor Node":
append_cnode(asset_data)

elif asset_type == "Geo Node":
append_gnode(asset_data)

elif asset_type == "Shader Node":
append_snode(asset_data)

Expand Down Expand Up @@ -96,6 +102,36 @@ def append_snode(asset_data):
Node = current_material.node_tree.nodes.new(type='ShaderNodeGroup')
Node.node_tree = bpy.data.node_groups[Node_name]

def append_cnode(asset_data):
Node_name = asset_data.get("Node_name", "")
Blend_file = asset_data.get("File_path", "")
Script_path = asset_data.get("File_path", "").replace(".blend", ".py")

if Node_name not in bpy.data.node_groups:
try:
with bpy.data.libraries.load(Blend_file, link=False) as (data_from, data_to):
data_to.node_groups = [Node_name]
except:
Absolute_Solver("009", Node_name, traceback.format_exc())

if os.path.isfile(Script_path):
run_python_script(asset_data.get("Asset_name"), Script_path)
dprint(f"{Node_name} Script Found")

else:
dprint(f"{Node_name} Script Not Found, using default algorithm")
bpy.context.scene.use_nodes = True
tree = bpy.context.scene.node_tree
Node = None
for node in tree:
if node.type == 'GROUP':
if Node_name in node.node_tree.name:
Node = node

if Node == None:
Node = tree.nodes.new('CompositorNodeGroup')
Node.node_tree = bpy.data.node_groups[Node_name]

def append_gnode(asset_data):
Node_name = asset_data.get("Node_name", "")
Append_mode = asset_data.get("Append_mode", "Active Only")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"Asset_name": "Vignette",
"Asset_version": "4.1",
"Author": "Aspirata",
"File_path": "Nodes\\Compositing Nodes\\Vignette\\Vignette",
"File_path": "Nodes\\Compositor Nodes\\Vignette\\Vignette",
"Node_name": "Vignette V4.1",
"Tags": ["Compositing Node", "Node"]
"Tags": ["Compositor Node", "Node"]
}
4 changes: 2 additions & 2 deletions MiBlend_Source/UI.py
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@ def draw(self, context):
if assets_props.filters:
sbox = box.box()
primary_tags = {"Rig", "Script", "Shader Node", "Geo Node", "Compositor Node", "Model", "Material"}
secondary_tags = {"Simple", "Realistic", "Node", "Particles"}
secondary_tags = {"Simple", "Realistic", "Story Mode", "Node", "Particles"}

row = sbox.row()
row.label(text="Tags:")
Expand Down Expand Up @@ -907,7 +907,7 @@ def get_custom_icon(self, item):
"Rig": "ARMATURE_DATA",
"Material": "MATERIAL_DATA",
"Script": "FILE_SCRIPT",
"Compositor Node": "MATERIAL_DATA",
"Compositor Node": "NODE_SEL",
"Shader Node": "NODE",
"Geo Nodes": "GEOMETRY_NODES",
"Model": "OBJECT_DATA",
Expand Down
0 build.sh → build_linux.sh
100755 → 100644
File renamed without changes.
43 changes: 43 additions & 0 deletions build_windows.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
@echo off
setlocal

rem Вставьте вашу команду или утилиту (если она нужна)
rem bab

set targetFile=MiBlend.blend

rem Получаем PID процесса Blender
for /f "tokens=2" %%a in ('tasklist /FI "IMAGENAME eq blender.exe" /FO LIST ^| find "PID"') do (
set blenderPID=%%a
)

rem Если процесс Blender запущен
if defined blenderPID (
echo Найден процесс Blender с PID: %blenderPID%

rem Проверяем, открыт ли файл MiBlend.blend
for /f "tokens=*" %%b in ('wmic process where "ProcessId=%blenderPID%" get CommandLine ^| find /I "%targetFile%"') do (
echo Файл %targetFile% открыт в Blender. Перезапускаем Blender...

rem Завершаем процесс Blender
taskkill /PID %blenderPID% /F
echo Ожидание завершения процесса Blender...

rem Ждем завершения процесса
:waitLoop
tasklist /FI "PID eq %blenderPID%" 2>NUL | find "%blenderPID%" > NUL
if %ERRORLEVEL% equ 0 (
timeout /T 1 > NUL
goto waitLoop
)

rem Перезапуск Blender
echo Перезапуск Blender...
start "" "C:\Program Files\Blender Foundation\Blender\blender.exe" "C:\path\to\your\MiBlend.blend"
exit /B 0
)
) else (
echo Blender не запущен.
)

endlocal

0 comments on commit 62c1a7f

Please sign in to comment.