The problem is that the particle system breaks down strangely and systematically. @Alayan
I have a backup method that's not very practical but functional (thanks to Sven, without him it would have taken me 3 months to decide to do it XD)
---
I have a backup method that's not very practical but functional (thanks to Sven, without him it would have taken me 3 months to decide to do it XD)
---
Code:
# Keep a copy for any changes
# The copy must have activated "Switch to point instance enabled" for "GeoNodeParticle".
import bpy, subprocess, pprint, random
subprocess.run("clear")
obj_particle = bpy.context.selected_objects
n_point = [] # data (object_point/location/rotation/scale/proxy)
def separate_point():
bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.separate(type='LOOSE')
bpy.ops.object.mode_set(mode='OBJECT')
bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY')
def check_n_point():
for i, obj in enumerate(bpy.context.selected_objects, 1):
rotation = 0
scale = 1
location = (obj.location.x, obj.location.y, obj.location.z)
n_point.append([obj, location, rotation, scale])
pprint.pprint(n_point)
def new_scale():
for i in n_point:
a = random.uniform(0.6, 1)
i[3] = a
def new_rotation():
for i in n_point:
a = random.uniform(-6.28319, 6.28319)
i[2] = a
def attribute_proxy_to_point(obj):
bpy.ops.object.select_all(action='DESELECT')
bpy.ops.object.select_pattern(pattern=obj, case_sensitive=True, extend=False)
fix = 1
for n in range(len(n_point)):
copy = bpy.ops.object.duplicate_move(OBJECT_OT_duplicate={"linked":True, "mode":'TRANSLATION'}, TRANSFORM_OT_translate={"value":(0, 0, 0), "orient_type":'GLOBAL', "orient_matrix":((0, 0, 0), (0, 0, 0), (0, 0, 0)), "orient_matrix_type":'GLOBAL', "constraint_axis":(False, False, False), "mirror":False, "use_proportional_edit":False, "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "use_proportional_connected":False, "use_proportional_projected":False, "snap":False, "snap_elements":{'INCREMENT'}, "use_snap_project":False, "snap_target":'CLOSEST', "use_snap_self":True, "use_snap_edit":True, "use_snap_nonedit":True, "use_snap_selectable":False, "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "gpencil_strokes":False, "cursor_transform":False, "texture_space":False, "remove_on_cancel":False, "view2d_edge_pan":False, "release_confirm":False, "use_accurate":False, "use_automerge_and_split":False})
n_point[n].append(bpy.data.objects[obj+"."+str(fix).zfill(3)])
fix += 1
for i in n_point:
i[4].location = i[0].location
def modify_rotation_proxy():
for i in n_point:
i[4].rotation_euler.z = i[2]
def modify_scale_proxy():
for i in n_point:
i[4].scale.xyz = i[3]
def clear_point():
for i in n_point:
obj = bpy.data.objects.get(i[0].name)
if obj:
bpy.ops.object.select_all(action='DESELECT')
obj.select_set(True)
bpy.context.view_layer.objects.active = obj
bpy.ops.object.delete()
for i in n_point:
obj = bpy.data.objects.get(i[4].name)
if obj:
obj.name = obj.name+"-geo-node"
separate_point()
check_n_point()
new_scale()
new_rotation()
attribute_proxy_to_point("boxe22") # Name of your object
modify_rotation_proxy()
modify_scale_proxy()
clear_point()
#pprint.pprint(n_point)
