Skip to content

Commit d2d16dd

Browse files
committed
Merge remote-tracking branch 'upstream/main' into smart-include-function
2 parents de8744f + 7cdb920 commit d2d16dd

File tree

8 files changed

+206
-41
lines changed

8 files changed

+206
-41
lines changed

LowPolySkinnedMario.blend

-2.86 MB
Binary file not shown.

LowPolySkinnedMario_V5.blend

-5.28 MB
Binary file not shown.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ Make sure to save often, as this plugin is prone to crashing when creating mater
1212

1313
<https://developer.blender.org/T70574>
1414

15+
### Example models can be found [here](https://github.com/Fast-64/fast64-models)
1516

1617
![alt-text](/images/mat_inspector.png)
1718

1819
### Credits
1920
Thanks to anonymous_moose, Cheezepin, Rovert, and especially InTheBeef for testing.
20-
Thanks to InTheBeef for LowPolySkinnedMario.
2121

2222
### Discord Server
2323
We have a Discord server for support as well as development [here](https://discord.gg/ny7PDcN2x8).

__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949

5050
from .fast64_internal.render_settings import (
5151
Fast64RenderSettings_Properties,
52+
ManualUpdatePreviewOperator,
5253
resync_scene_props,
5354
on_update_render_settings,
5455
)
@@ -311,6 +312,7 @@ def draw(self, context):
311312
classes = (
312313
Fast64Settings_Properties,
313314
Fast64RenderSettings_Properties,
315+
ManualUpdatePreviewOperator,
314316
Fast64_Properties,
315317
Fast64_BoneProperties,
316318
Fast64_ObjectProperties,

fast64_internal/f3d/f3d_material.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@
3434
from .f3d_gbi import get_F3D_GBI, enumTexScroll, isUcodeF3DEX1, default_draw_layers
3535
from .f3d_material_presets import *
3636
from ..utility import *
37-
from ..render_settings import Fast64RenderSettings_Properties, update_scene_props_from_render_settings
37+
from ..render_settings import (
38+
Fast64RenderSettings_Properties,
39+
update_scene_props_from_render_settings,
40+
ManualUpdatePreviewOperator,
41+
)
3842
from .f3d_material_helpers import F3DMaterial_UpdateLock, node_tree_copy
3943
from bpy.app.handlers import persistent
4044
from typing import Generator, Optional, Tuple, Any, Dict, Union
@@ -2425,7 +2429,7 @@ def createOrUpdateSceneProperties():
24252429
sceneOutputs: NodeGroupOutput = new_group.nodes["Group Output"]
24262430
renderSettings: "Fast64RenderSettings_Properties" = bpy.context.scene.fast64.renderSettings
24272431

2428-
update_scene_props_from_render_settings(bpy.context, sceneOutputs, renderSettings)
2432+
update_scene_props_from_render_settings(sceneOutputs, renderSettings)
24292433

24302434

24312435
def createScenePropertiesForMaterial(material: Material):
@@ -4709,6 +4713,18 @@ def draw(self, context):
47094713
labelbox.label(text="Global Settings")
47104714
labelbox.ui_units_x = 6
47114715

4716+
# Only show the update preview UI if the render engine is EEVEE,
4717+
# as there's no point in updating the nodes otherwise.
4718+
if context.scene.render.engine in {
4719+
"BLENDER_EEVEE", # <4.2
4720+
"BLENDER_EEVEE_NEXT", # 4.2+
4721+
}:
4722+
updatePreviewRow = globalSettingsBox.row()
4723+
updatePreviewRow.prop(renderSettings, "enableAutoUpdatePreview")
4724+
if not renderSettings.enableAutoUpdatePreview:
4725+
updatePreviewRow.operator(ManualUpdatePreviewOperator.bl_idname)
4726+
globalSettingsBox.separator()
4727+
47124728
globalSettingsBox.prop(renderSettings, "enableFogPreview")
47134729
prop_split(globalSettingsBox, renderSettings, "fogPreviewColor", "Fog Color")
47144730
prop_split(globalSettingsBox, renderSettings, "fogPreviewPosition", "Fog Position")

fast64_internal/f3d_material_converter.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -186,16 +186,16 @@ def convertAllBSDFtoF3D(objs, renameUV):
186186
def convertBSDFtoF3D(obj, index, material, materialDict):
187187
if not material.use_nodes:
188188
newMaterial = createF3DMat(obj, preset="Shaded Solid", index=index)
189-
f3dMat = newMaterial.f3d_mat if newMaterial.mat_ver > 3 else newMaterial
190-
f3dMat.default_light_color = material.diffuse_color
189+
with bpy.context.temp_override(material=newMaterial):
190+
newMaterial.f3d_mat.default_light_color = material.diffuse_color
191191
updateMatWithName(newMaterial, material, materialDict)
192192

193193
elif "Principled BSDF" in material.node_tree.nodes:
194194
tex0Node = material.node_tree.nodes["Principled BSDF"].inputs["Base Color"]
195195
if len(tex0Node.links) == 0:
196196
newMaterial = createF3DMat(obj, preset=getDefaultMaterialPreset("Shaded Solid"), index=index)
197-
f3dMat = newMaterial.f3d_mat if newMaterial.mat_ver > 3 else newMaterial
198-
f3dMat.default_light_color = tex0Node.default_value
197+
with bpy.context.temp_override(material=newMaterial):
198+
newMaterial.f3d_mat.default_light_color = tex0Node.default_value
199199
updateMatWithName(newMaterial, material, materialDict)
200200
else:
201201
if isinstance(tex0Node.links[0].from_node, bpy.types.ShaderNodeTexImage):
@@ -213,8 +213,8 @@ def convertBSDFtoF3D(obj, index, material, materialDict):
213213
else:
214214
presetName = getDefaultMaterialPreset("Shaded Texture")
215215
newMaterial = createF3DMat(obj, preset=presetName, index=index)
216-
f3dMat = newMaterial.f3d_mat if newMaterial.mat_ver > 3 else newMaterial
217-
f3dMat.tex0.tex = tex0Node.links[0].from_node.image
216+
with bpy.context.temp_override(material=newMaterial):
217+
newMaterial.f3d_mat.tex0.tex = tex0Node.links[0].from_node.image
218218
updateMatWithName(newMaterial, material, materialDict)
219219
else:
220220
print("Principled BSDF material does not have an Image Node attached to its Base Color.")

0 commit comments

Comments
 (0)