Skip to content

Commit

Permalink
New Dev Tools UI
Browse files Browse the repository at this point in the history
  • Loading branch information
Aspirata committed Jul 19, 2024
1 parent 7d1d3c2 commit 44d207e
Show file tree
Hide file tree
Showing 7 changed files with 89 additions and 50 deletions.
21 changes: 18 additions & 3 deletions Mcblend Source/Data.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,32 @@
"eevee.overscan_size": 10.0
},

"Aspirata Eevee":{
"Aspirata Eevee Viewport":{
"eevee.taa_samples": 16,
"eevee.taa_render_samples": 16,
"eevee.shadow_ray_count": 1,
"eevee.shadow_step_count": 16,
"eevee.use_volumetric_shadows": True,
"eevee.use_raytracing": True,
"eevee.ray_tracing_options.resolution_scale": '4',
"eevee.ray_tracing_options.trace_max_roughness": 0,
"eevee.fast_gi_resolution": '4',
"eevee.fast_gi_ray_count": 1,
"eevee.fast_gi_step_count": 16,
},

"Aspirata Eevee Render":{
"eevee.taa_samples": 32,
"eevee.taa_render_samples": 32,
"eevee.use_shadow_jitter_viewport": True,
"eevee.shadow_ray_count": 2,
"eevee.shadow_step_count": 16,
"eevee.use_volumetric_shadows": True,
"eevee.use_raytracing": True,
"eevee.ray_tracing_options.resolution_scale": '4',
"eevee.ray_tracing_options.trace_max_roughness": 0,
"eevee.fast_gi_resolution": '4',
"eevee.fast_gi_ray_count": 2,
"eevee.fast_gi_step_count": 16,
"eevee.use_overscan": True,
"eevee.overscan_size": 10.0,
}
Expand Down Expand Up @@ -217,7 +232,7 @@

Alpha_Blend_Materials = ["water"]

SSS_Materials = ["leaves", "grass", "tulip", "oxeye_daisy", "dandelion", "poppy", "blue_orchid", "torchflower", "lily_of_the_valley", "cornflower", "allium", "azure bluet"]
SSS_Materials = ["leaves", "grass", "tulip", "oxeye_daisy", "dandelion", "poppy", "blue_orchid", "torchflower", "lily_of_the_valley", "cornflower", "allium", "azure bluet", "azalea", "cactus", "wheat", "hay"]

Translucent_Materials = ["leaves", "glass"]

Expand Down
2 changes: 1 addition & 1 deletion Mcblend Source/MCB_API.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def wrapper(*args, **kwargs):
func(*args, **kwargs)
end_time = time.time()
elapsed_time = end_time - start_time
if elapsed_time > 0.001:
if elapsed_time > 0.001 and bpy.context.preferences.addons[__package__].preferences.dev_tools and bpy.context.preferences.addons[__package__].preferences.perf_time:
dprint(f"{func.__name__}() took {end_time - start_time:.4f} seconds to complete.")
return wrapper

Expand Down
Binary file modified Mcblend Source/Materials/Clouds generator 3.6.blend
Binary file not shown.
75 changes: 37 additions & 38 deletions Mcblend Source/Materials/Materials.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def fix_world():
if WProperties.lazy_biome_fix:
material_parts = image_texture_node.image.name.lower().replace(".png", "").replace("-", "_").split("_")

if any(part in material_parts for part in ("grass", "water", "leaves", "stem", "lily", "vine")) or ("redstone" and "dust" in material_parts) and all(part not in material_parts for part in ("cherry", "side")):
if any(part in material_parts for part in ("grass", "water", "leaves", "stem", "lily", "vine", "fern")) or ("redstone" and "dust" in material_parts) and all(part not in material_parts for part in ("cherry", "side", "azalea")):
if lbcf_node is None:
if "Lazy Biome Color Fix" not in bpy.data.node_groups:
try:
Expand Down Expand Up @@ -711,48 +711,47 @@ def setproceduralpbr():
if (mult_socket := GetConnectedSocketTo("Multiply", node_group)) is not None:
material.node_tree.links.new(mult_socket, PBSDF.inputs["Emission Strength"])
material.node_tree.nodes.remove(node_group)
if Preferences.dev_tools and Preferences.experimental_features:
if PProperties.proughness:
if proughness_node is None:
proughness_node = material.node_tree.nodes.new(type='ShaderNodeMapRange')
proughness_node.name = "Procedural Roughness Node"
proughness_node.location = (PBSDF.location.x - 180, PBSDF.location.y - 90)
proughness_node.hide = True

proughness_node.interpolation_type = PProperties.pr_interpolation
proughness_node.inputs["From Max"].default_value = 0.0
proughness_node.inputs["From Min"].default_value = 1.0
proughness_node.inputs["To Max"].default_value = PBSDF.inputs["Roughness"].default_value
proughness_node.inputs["To Min"].default_value = PBSDF.inputs["Roughness"].default_value * PProperties.pr_dif

material.node_tree.links.new(GetConnectedSocketTo("Base Color", PBSDF), proughness_node.inputs["Value"])
material.node_tree.links.new(proughness_node.outputs[0], PBSDF.inputs["Roughness"])

if PProperties.proughness and Preferences.dev_tools:
if proughness_node is None:
proughness_node = material.node_tree.nodes.new(type='ShaderNodeMapRange')
proughness_node.name = "Procedural Roughness Node"
proughness_node.location = (PBSDF.location.x - 180, PBSDF.location.y - 90)
proughness_node.hide = True

proughness_node.interpolation_type = PProperties.pr_interpolation
proughness_node.inputs["From Max"].default_value = 0.0
proughness_node.inputs["From Min"].default_value = 1.0
proughness_node.inputs["To Max"].default_value = PBSDF.inputs["Roughness"].default_value
proughness_node.inputs["To Min"].default_value = PBSDF.inputs["Roughness"].default_value * PProperties.pr_dif

material.node_tree.links.new(GetConnectedSocketTo("Base Color", PBSDF), proughness_node.inputs["Value"])
material.node_tree.links.new(proughness_node.outputs[0], PBSDF.inputs["Roughness"])

elif PProperties.pr_revert and proughness_node is not None:
material.node_tree.nodes.remove(proughness_node)

if PProperties.pspecular and Preferences.dev_tools:
if pspecular_node is None:
pspecular_node = material.node_tree.nodes.new(type='ShaderNodeMapRange')
pspecular_node.name = "Procedural Specular Node"
pspecular_node.location = (PBSDF.location.x - 180, PBSDF.location.y - 200)
pspecular_node.hide = True

pspecular_node.interpolation_type = PProperties.ps_interpolation
pspecular_node.inputs["From Max"].default_value = 1.0
pspecular_node.inputs["From Min"].default_value = 0.0
pspecular_node.inputs["To Max"].default_value = PBSDF.inputs[PBSDF_compability("Specular IOR Level")].default_value
pspecular_node.inputs["To Min"].default_value = PBSDF.inputs[PBSDF_compability("Specular IOR Level")].default_value * PProperties.ps_dif
elif PProperties.pr_revert and proughness_node is not None:
material.node_tree.nodes.remove(proughness_node)

material.node_tree.links.new(GetConnectedSocketTo("Base Color", PBSDF), pspecular_node.inputs["Value"])
material.node_tree.links.new(pspecular_node.outputs[0], PBSDF.inputs[PBSDF_compability("Specular IOR Level")])

elif PProperties.ps_revert and pspecular_node is not None:
material.node_tree.nodes.remove(pspecular_node)
if PProperties.pspecular:
if pspecular_node is None:
pspecular_node = material.node_tree.nodes.new(type='ShaderNodeMapRange')
pspecular_node.name = "Procedural Specular Node"
pspecular_node.location = (PBSDF.location.x - 180, PBSDF.location.y - 200)
pspecular_node.hide = True

pspecular_node.interpolation_type = PProperties.ps_interpolation
pspecular_node.inputs["From Max"].default_value = 1.0
pspecular_node.inputs["From Min"].default_value = 0.0
pspecular_node.inputs["To Max"].default_value = PBSDF.inputs[PBSDF_compability("Specular IOR Level")].default_value
pspecular_node.inputs["To Min"].default_value = PBSDF.inputs[PBSDF_compability("Specular IOR Level")].default_value * PProperties.ps_dif

material.node_tree.links.new(GetConnectedSocketTo("Base Color", PBSDF), pspecular_node.inputs["Value"])
material.node_tree.links.new(pspecular_node.outputs[0], PBSDF.inputs[PBSDF_compability("Specular IOR Level")])

elif PProperties.ps_revert and pspecular_node is not None:
material.node_tree.nodes.remove(pspecular_node)

else:
Absolute_Solver("m002", slot)

else:
Absolute_Solver("m003", selected_object)
#
Expand Down
35 changes: 30 additions & 5 deletions Mcblend Source/Preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,25 @@ def emissiondetectionfix():
)

dprint: BoolProperty(
name="Enable dprint",
name="dprint",
default=True
)

perf_time: BoolProperty(
name="Perf_Time",
default=False
)

debug_tools: BoolProperty(
name="Debug Tools",
default=False
)

experimental_features: BoolProperty(
name="Experimental Features",
default=False
)

open_console_on_start: BoolProperty(
name="Open Console On Start",
default=False
Expand Down Expand Up @@ -106,18 +121,28 @@ def draw(self, context):

box = layout.box()
row = box.row()
row.prop(self, "dev_tools", text="")
row.label(text="Dev Tools:") # Dev Tools

row = box.row()
row.prop(self, "dev_tools")

if self.dev_tools:
row = box.row()
row.prop(self, "dprint", toggle=True)

row = box.row()
row.prop(self, "perf_time", toggle=True)

row = box.row()
row.prop(self, "debug_tools", toggle=True)

row = box.row()
row.prop(self, "experimental_features", toggle=True)

row = box.row()
row.prop(self, "open_console_on_start", toggle=True)

row = box.row()
row.prop(self, "dev_packs_path")
row.prop(self, "enable_custom_packs_path", text="")
row.prop(self, "enable_custom_packs_path", text="")
else:
row = box.row()
row.label(text="Dev Tools Disabled")
6 changes: 3 additions & 3 deletions Mcblend Source/UI.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def draw(self, context):
row.enabled = scene.resource_properties.animate_textures
row.prop(scene.resource_properties, "only_fix_uv")

if Preferences.dev_tools:
if Preferences.dev_tools and Preferences.debug_tools:
row = box.row()
remove_attr = row.operator("special.remove_attribute", text="Remove Resource Packs List")
remove_attr.attribute = "resource_packs"
Expand Down Expand Up @@ -494,7 +494,7 @@ def draw(self, context):
row.prop(scene.ppbr_properties, "revert_normals", slider=True)
row.enabled = not context.scene.ppbr_properties.use_normals

if Preferences.dev_tools:
if Preferences.dev_tools and Preferences.experimental_features:
row = box.row()
row.prop(scene.ppbr_properties, "pspecular")
row.prop(scene.ppbr_properties, "pspecular_settings", icon=("TRIA_DOWN" if scene.ppbr_properties.pspecular_settings else "TRIA_LEFT"), icon_only=True)
Expand Down Expand Up @@ -794,7 +794,7 @@ def importcategoryfix():
row = box.row()
row.operator("assets.update_assets")

if Preferences.dev_tools:
if Preferences.dev_tools and Preferences.debug_tools:
row = box.row()
remove_attr = row.operator("special.remove_attribute", text="Remove Assets List")
remove_attr.attribute = "assetsproperties.asset_items"
Expand Down
Binary file modified Mcblend.blend
Binary file not shown.

0 comments on commit 44d207e

Please sign in to comment.