Skip to content

Commit 7ba0f00

Browse files
authored
Merge pull request #979 from CodeFHD/for_v2.10
Reactivate some previous commits
2 parents 0c95aba + 9f46c04 commit 7ba0f00

21 files changed

Lines changed: 88 additions & 59 deletions

export/caches/object_cache.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,6 @@ def _convert_mesh_obj(self, exporter, dg_obj_instance, obj, obj_key, depsgraph,
482482
for idx, (shape_name, mat_index) in enumerate(exported_mesh.mesh_definitions):
483483
shape = shape_name
484484
lux_mat_name, mat_props, node_tree = export_material(obj, mat_index, exporter, depsgraph, is_viewport_render)
485-
print(lux_mat_name)
486485
scene_props.Set(mat_props)
487486
mat_names.append(lux_mat_name)
488487

export/hair.py

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ def convert_hair(exporter, obj, obj_key, psys, depsgraph, luxcore_scene, scene_p
120120
start = 0
121121
else:
122122
# Number of virtual parents reduces the number of exported children
123-
num_virtual_parents = math.trunc(0.3 * psys.settings.virtual_parents
124-
* psys.settings.child_percent * num_parents)
123+
num_virtual_parents = math.trunc(
124+
0.3 * psys.settings.virtual_parents * len(psys.child_particles) * num_parents)
125125
start = num_parents + num_virtual_parents
126126

127127
# Collect point/color/uv information from Blender
@@ -257,16 +257,13 @@ def convert_hair_curves(exporter, depsgraph, obj, obj_key, luxcore_scene, is_for
257257

258258
strands = obj.data.curves
259259

260-
max_strand_length = 0
261-
for strand in strands:
262-
if strand.points_length > max_strand_length:
263-
max_strand_length = strand.points_length
260+
points_per_strand = np.fromiter((strand.points_length
261+
for strand in strands), dtype=np.int32)
264262

265263
points = np.fromiter((elem
266264
for strand in strands
267-
for idx in range(0, max_strand_length)
268-
for elem in get_strand_seg(idx, strand)),
269-
dtype=np.float32)
265+
for idx in range(strand.points_length)
266+
for elem in strand.points[idx].position), dtype=np.float32)
270267

271268
colors = np.empty(shape=0, dtype=np.float32)
272269
uvs = np.empty(shape=0, dtype=np.float32)
@@ -283,8 +280,6 @@ def convert_hair_curves(exporter, depsgraph, obj, obj_key, luxcore_scene, is_for
283280
uvs_needed = settings.copy_uv_coords
284281
copy_uvs = settings.copy_uv_coords
285282

286-
uvs_needed = False
287-
288283
if export_color != "none" or uvs_needed:
289284
emitter_mesh = obj.parent.to_mesh(depsgraph=depsgraph)
290285
vertex_colors = emitter_mesh.vertex_colors
@@ -306,13 +301,11 @@ def convert_hair_curves(exporter, depsgraph, obj, obj_key, luxcore_scene, is_for
306301
for elem in uv_coord.vector),
307302
dtype=np.float32)
308303

309-
310304
if len(uvs) == 0:
311305
copy_uvs = False
312306

313307
transformation = None
314-
315-
success = luxcore_scene.DefineBlenderStrands(lux_shape_name, max_strand_length,
308+
success = luxcore_scene.DefineBlenderCurveStrands(lux_shape_name, points_per_strand,
316309
points, colors, uvs, image_filename, settings.gamma,
317310
copy_uvs, transformation, strand_diameter,
318311
root_width, tip_width, width_offset,

nodes/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
sockets.LuxCoreSocketFloat0to1,
5151
sockets.LuxCoreSocketFloat0to2,
5252
sockets.LuxCoreSocketBumpHeight,
53+
sockets.LuxCoreSocketFloatDisneySheen,
5354
sockets.LuxCoreSocketVector,
5455
sockets.LuxCoreSocketRoughness,
5556
sockets.LuxCoreSocketIOR,

nodes/materials/disney.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def init(self, context):
2525
self.add_input("LuxCoreSocketFloat0to1", "Specular Tint", 0)
2626
self.add_input("LuxCoreSocketFloat0to1", "Roughness", 0.2)
2727
self.add_input("LuxCoreSocketFloat0to1", "Anisotropic", 0)
28-
self.add_input("LuxCoreSocketFloatPositive", "Sheen", 0)
28+
self.add_input("LuxCoreSocketFloatDisneySheen", "Sheen", 0)
2929
self.add_input("LuxCoreSocketFloat0to1", "Sheen Tint", 0)
3030
self.add_input("LuxCoreSocketFloat0to1", "Clearcoat", 0)
3131
self.add_input("LuxCoreSocketFloat0to1", "Clearcoat Gloss", 1)

nodes/materials/glass.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,11 @@ def init(self, context):
7777
ThinFilmCoating.init(self)
7878

7979
Roughness.init(self, default=0.05, init_enabled=False)
80-
Roughness.update_anisotropy(self, context)
8180

8281
self.add_common_inputs()
8382

8483
self.outputs.new("LuxCoreSocketMaterial", "Material")
84+
Roughness.update_anisotropy(self, context)
8585

8686

8787
def draw_buttons(self, context, layout):

nodes/materials/glossy2.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,14 @@ def update_use_ior(self, context):
1818
self.inputs[id].enabled = not self.use_ior
1919
utils_node.force_viewport_update(self, context)
2020

21-
multibounce: BoolProperty(update=utils_node.force_viewport_update, name="Multibounce", default=False,
21+
multibounce: BoolProperty(update=utils_node.force_viewport_update,
22+
name="Multibounce",
23+
default=False,
2224
description=MULTIBOUNCE_DESCRIPTION)
23-
use_ior: BoolProperty(name="Use IOR", default=False,
24-
update=update_use_ior,
25-
description=IOR_DESCRIPTION)
25+
use_ior: BoolProperty(name="Use IOR",
26+
default=False,
27+
update=update_use_ior,
28+
description=IOR_DESCRIPTION)
2629
use_anisotropy: BoolProperty(name=Roughness.aniso_name,
2730
default=False,
2831
description=Roughness.aniso_desc,

nodes/materials/metal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def change_input_type(self, context):
4646
def init(self, context):
4747
self.add_input("LuxCoreSocketColor", "Color", (0.7, 0.7, 0.7))
4848
self.inputs.new("LuxCoreSocketFresnel", "Fresnel")
49-
self.inputs["Fresnel"].enabled = False
49+
self.inputs["Fresnel"].enabled = False
5050
Roughness.init(self, 0.05)
5151

5252
self.add_common_inputs()

nodes/sockets.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,13 @@ class LuxCoreSocketBumpHeight(bpy.types.NodeSocket, LuxCoreSocketFloat):
212212
precision=FLOAT_UI_PRECISION)
213213

214214

215+
class LuxCoreSocketFloatDisneySheen(bpy.types.NodeSocket, LuxCoreSocketFloat):
216+
default_value: FloatProperty(min=0, max=100, soft_max=10.0, description="Sheen value",
217+
update=utils_node.force_viewport_update,
218+
precision=FLOAT_UI_PRECISION)
219+
slider = True
220+
221+
215222
class LuxCoreSocketVector(bpy.types.NodeSocket, LuxCoreNodeSocket):
216223
color = Color.vector_texture
217224
default_value: FloatVectorProperty(name="", subtype="XYZ",

nodes/textures/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
smoke.LuxCoreNodeTexSmoke,
6767
splitfloat3.LuxCoreNodeTexSplitFloat3,
6868
timeinfo.LuxCoreNodeTexTimeInfo,
69+
tree.LuxCoreTextureNodeTree,
6970
triplanar.LuxCoreNodeTexTriplanar,
7071
triplanar_bump.LuxCoreNodeTexTriplanarBump,
7172
triplanar_normalmap.LuxCoreNodeTexTriplanarNormalmap,

nodes/textures/colormix.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,19 @@ class LuxCoreNodeTexColorMix(LuxCoreNodeTexture, bpy.types.Node):
2121
]
2222

2323
def change_mode(self, context):
24+
id = self.inputs.find("Color 2")
2425
if self.mode in {"clamp", "abs"}:
2526
self.inputs[1].name = "Color"
26-
self.inputs["Color 2"].enabled = False
27+
self.inputs[id].enabled = False
2728
else:
2829
self.inputs[1].name = "Color 1"
29-
self.inputs["Color 2"].enabled = True
30+
self.inputs[id].enabled = True
3031

32+
id = self.inputs.find("Fac")
3133
if self.mode == "mix":
32-
self.inputs["Fac"].enabled = True
34+
self.inputs[id].enabled = True
3335
else:
34-
self.inputs["Fac"].enabled = False
36+
self.inputs[id].enabled = False
3537
utils_node.force_viewport_update(self, context)
3638

3739
mode: EnumProperty(name="Mode", items=mode_items, default="mix", update=change_mode)

0 commit comments

Comments
 (0)