Styling a PointCloud in Blender [Blender 2.93] | English

Jonathan Kron
Jonathan Kron
17.6 هزار بار بازدید - 3 سال پیش - In this tutorial, I show
In this tutorial, I show you how to style a point cloud in Blender using a Python script.
Point Cloud Visualizer: https://github.com/uhlik/bpy
Gumroad: https://gumroad.com/jonathankron
Blender Market: https://blendermarket.com/creators/jo...

-----------------------------------------------------

Script:

import bpy
import bmesh
import mathutils

r_digit = 2

context = bpy.context

ob = context.object
me = ob.data
bm = bmesh.new()
bm.from_mesh(me)

counter = 0
for f in bm.faces:
   print(counter)
   counter += 1
   #print("Center: " + str(f.calc_center_median()))
   old_center = f.calc_center_median()
   new_center = [round(old_center[0],r_digit),round(old_center[1],r_digit),round(old_center[2],r_digit)]
   #print(new_center)
   
   x_offset = new_center[0] - old_center[0]
   y_offset = new_center[1] - old_center[1]
   z_offset = new_center[2] - old_center[2]
   
   #print(x_offset,y_offset,z_offset)
   
   for v in f.verts:
       #print(v.co)
       v.co += mathutils.Vector((x_offset, y_offset, z_offset))
       #print(v.co)
   #print("#")

bm.to_mesh(me)
me.update()

-----------------------------------------------------

*Products I use*

DECALmachine*: https://gumroad.com/a/1070707827

-----------------------------------------------------

*Partners*

EcraxOfficial:
@ecrax_

-----------------------------------------------------

*Affiliate links for products I use daily!
3 سال پیش در تاریخ 1400/04/12 منتشر شده است.
17,693 بـار بازدید شده
... بیشتر