-
Notifications
You must be signed in to change notification settings - Fork 0
Adding magnets to custom objects
Joshua edited this page Sep 10, 2020
·
1 revision
- Extract the render model of the object you wish to add magnets to using tagtool or some other method.
- import the extracted model into blender. and set the rotation to 0,0,0
- Add primitives with the name magnetMarker (Blender will automatically number them to prevent name collisions)
- Execute the export markers script in the python console (shfit+f4)
- Take the json dump and append it to magnets.json with the render model name stringid as the key
- Reload the map
scaling v will have the same effect as setting CloneDepth
obj = bpy.context.selected_objects[0]
for p in [v[:] for v in obj.bound_box]:
v = obj.matrix_world * Vector(p)
bpy.ops.mesh.primitive_uv_sphere_add(size=0.05, location=v)
bpy.context.active_object.name = 'magnetMarker'import json
print(json.dumps([ [round(a, 2) for a in o.location] for o in bpy.data.objects if o.name.startswith('magnetMarker')]))import json
for o in json.loads(magnetJson):
bpy.ops.mesh.primitive_uv_sphere_add(size=0.05, location=o)
bpy.context.active_object.name = 'magnetMarker'