Add Mesh Extra Objects: make solids use ngons #105128
@ -13,7 +13,7 @@
|
|||||||
bl_info = {
|
bl_info = {
|
||||||
"name": "Extra Objects",
|
"name": "Extra Objects",
|
||||||
"author": "Multiple Authors",
|
"author": "Multiple Authors",
|
||||||
"version": (0, 3, 9),
|
"version": (0, 3, 10),
|
||||||
"blender": (2, 80, 0),
|
"blender": (2, 80, 0),
|
||||||
"location": "View3D > Add > Mesh",
|
"location": "View3D > Add > Mesh",
|
||||||
"description": "Add extra mesh object types",
|
"description": "Add extra mesh object types",
|
||||||
|
@ -22,6 +22,11 @@ def vSum(list):
|
|||||||
return reduce(lambda a, b: a + b, list)
|
return reduce(lambda a, b: a + b, list)
|
||||||
|
|
||||||
|
|
||||||
|
# Get a copy of the input faces, but with the normals flipped by reversing the order of the vertex indices of each face.
|
||||||
|
def flippedFaceNormals(faces):
|
||||||
|
return [list(reversed(vertexIndices)) for vertexIndices in faces]
|
||||||
|
|
||||||
|
|
||||||
# creates the 5 platonic solids as a base for the rest
|
# creates the 5 platonic solids as a base for the rest
|
||||||
# plato: should be one of {"4","6","8","12","20"}. decides what solid the
|
# plato: should be one of {"4","6","8","12","20"}. decides what solid the
|
||||||
# outcome will be.
|
# outcome will be.
|
||||||
@ -117,7 +122,8 @@ def createSolid(plato, vtrunc, etrunc, dual, snub):
|
|||||||
vInput, fInput = source(dualSource[plato])
|
vInput, fInput = source(dualSource[plato])
|
||||||
supposedSize = vSum(vInput[i] for i in fInput[0]).length / len(fInput[0])
|
supposedSize = vSum(vInput[i] for i in fInput[0]).length / len(fInput[0])
|
||||||
vInput = [-i * supposedSize for i in vInput] # mirror it
|
vInput = [-i * supposedSize for i in vInput] # mirror it
|
||||||
return vInput, fInput
|
# Inverting vInput turns the mesh inside-out, so normals need to be flipped.
|
||||||
|
return vInput, flippedFaceNormals(fInput)
|
||||||
return source(plato)
|
return source(plato)
|
||||||
elif 0 < vtrunc <= 0.5: # simple truncation of the source
|
elif 0 < vtrunc <= 0.5: # simple truncation of the source
|
||||||
vInput, fInput = source(plato)
|
vInput, fInput = source(plato)
|
||||||
@ -129,10 +135,9 @@ def createSolid(plato, vtrunc, etrunc, dual, snub):
|
|||||||
if vtrunc == 0: # no truncation needed
|
if vtrunc == 0: # no truncation needed
|
||||||
if dual:
|
if dual:
|
||||||
vInput, fInput = source(plato)
|
vInput, fInput = source(plato)
|
||||||
vInput = [i * supposedSize for i in vInput]
|
|
||||||
return vInput, fInput
|
|
||||||
vInput = [-i * supposedSize for i in vInput]
|
vInput = [-i * supposedSize for i in vInput]
|
||||||
return vInput, fInput
|
# Inverting vInput turns the mesh inside-out, so normals need to be flipped.
|
||||||
|
return vInput, flippedFaceNormals(fInput)
|
||||||
|
|
||||||
# generate connection database
|
# generate connection database
|
||||||
vDict = [{} for i in vInput]
|
vDict = [{} for i in vInput]
|
||||||
@ -240,6 +245,10 @@ def createSolid(plato, vtrunc, etrunc, dual, snub):
|
|||||||
if supposedSize and not dual: # this to make the vtrunc > 1 work
|
if supposedSize and not dual: # this to make the vtrunc > 1 work
|
||||||
supposedSize *= len(fvOutput[0]) / vSum(vOutput[i] for i in fvOutput[0]).length
|
supposedSize *= len(fvOutput[0]) / vSum(vOutput[i] for i in fvOutput[0]).length
|
||||||
vOutput = [-i * supposedSize for i in vOutput]
|
vOutput = [-i * supposedSize for i in vOutput]
|
||||||
|
# Inverting vOutput turns the mesh inside-out, so normals need to be flipped.
|
||||||
|
flipNormals = True
|
||||||
|
else:
|
||||||
|
flipNormals = False
|
||||||
|
|
||||||
# create new faces by replacing old vert IDs by newly generated verts
|
# create new faces by replacing old vert IDs by newly generated verts
|
||||||
ffOutput = [[] for i in fInput]
|
ffOutput = [[] for i in fInput]
|
||||||
@ -258,7 +267,10 @@ def createSolid(plato, vtrunc, etrunc, dual, snub):
|
|||||||
ffOutput[x].append(fvOutput[i][vData[i][3].index(x) - 1])
|
ffOutput[x].append(fvOutput[i][vData[i][3].index(x) - 1])
|
||||||
|
|
||||||
if not dual:
|
if not dual:
|
||||||
return vOutput, fvOutput + feOutput + ffOutput
|
fOutput = fvOutput + feOutput + ffOutput
|
||||||
|
if flipNormals:
|
||||||
|
fOutput = flippedFaceNormals(fOutput)
|
||||||
|
return vOutput, fOutput
|
||||||
else:
|
else:
|
||||||
# do the same procedure as above, only now on the generated mesh
|
# do the same procedure as above, only now on the generated mesh
|
||||||
# generate connection database
|
# generate connection database
|
||||||
|
@ -55,8 +55,6 @@ class AutoKeying:
|
|||||||
options.add('INSERTKEY_VISUAL')
|
options.add('INSERTKEY_VISUAL')
|
||||||
if prefs.edit.use_keyframe_insert_needed:
|
if prefs.edit.use_keyframe_insert_needed:
|
||||||
options.add('INSERTKEY_NEEDED')
|
options.add('INSERTKEY_NEEDED')
|
||||||
if prefs.edit.use_insertkey_xyz_to_rgb:
|
|
||||||
options.add('INSERTKEY_XYZ_TO_RGB')
|
|
||||||
if ts.use_keyframe_cycle_aware:
|
if ts.use_keyframe_cycle_aware:
|
||||||
options.add('INSERTKEY_CYCLE_AWARE')
|
options.add('INSERTKEY_CYCLE_AWARE')
|
||||||
return options
|
return options
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
bl_info = {
|
bl_info = {
|
||||||
"name": "FBX format",
|
"name": "FBX format",
|
||||||
"author": "Campbell Barton, Bastien Montagne, Jens Restemeier, @Mysteryem",
|
"author": "Campbell Barton, Bastien Montagne, Jens Restemeier, @Mysteryem",
|
||||||
"version": (5, 11, 4),
|
"version": (5, 11, 5),
|
||||||
"blender": (4, 1, 0),
|
"blender": (4, 1, 0),
|
||||||
"location": "File > Import-Export",
|
"location": "File > Import-Export",
|
||||||
"description": "FBX IO meshes, UVs, vertex colors, materials, textures, cameras, lamps and actions",
|
"description": "FBX IO meshes, UVs, vertex colors, materials, textures, cameras, lamps and actions",
|
||||||
|
@ -686,7 +686,7 @@ def fbx_data_camera_elements(root, cam_obj, scene_data):
|
|||||||
elem_props_template_set(tmpl, props, "p_double", b"SafeAreaAspectRatio", aspect)
|
elem_props_template_set(tmpl, props, "p_double", b"SafeAreaAspectRatio", aspect)
|
||||||
# Depth of field and Focus distance.
|
# Depth of field and Focus distance.
|
||||||
elem_props_template_set(tmpl, props, "p_bool", b"UseDepthOfField", cam_data.dof.use_dof)
|
elem_props_template_set(tmpl, props, "p_bool", b"UseDepthOfField", cam_data.dof.use_dof)
|
||||||
elem_props_template_set(tmpl, props, "p_double", b"FocusDistance", cam_data.dof.focus_distance * 1000 * gscale)
|
elem_props_template_set(tmpl, props, "p_double", b"FocusDistance", cam_data.dof.focus_distance * gscale)
|
||||||
# Default to perspective camera.
|
# Default to perspective camera.
|
||||||
elem_props_template_set(tmpl, props, "p_enum", b"CameraProjectionType", 1 if cam_data.type == 'ORTHO' else 0)
|
elem_props_template_set(tmpl, props, "p_enum", b"CameraProjectionType", 1 if cam_data.type == 'ORTHO' else 0)
|
||||||
elem_props_template_set(tmpl, props, "p_double", b"OrthoZoom", cam_data.ortho_scale)
|
elem_props_template_set(tmpl, props, "p_double", b"OrthoZoom", cam_data.ortho_scale)
|
||||||
|
@ -2169,7 +2169,7 @@ def blen_read_camera(fbx_tmpl, fbx_obj, settings):
|
|||||||
|
|
||||||
camera.type = 'ORTHO' if elem_props_get_enum(fbx_props, b'CameraProjectionType', 0) == 1 else 'PERSP'
|
camera.type = 'ORTHO' if elem_props_get_enum(fbx_props, b'CameraProjectionType', 0) == 1 else 'PERSP'
|
||||||
|
|
||||||
camera.dof.focus_distance = elem_props_get_number(fbx_props, b'FocusDistance', 10 * 1000) / 1000 * global_scale
|
camera.dof.focus_distance = elem_props_get_number(fbx_props, b'FocusDistance', 10) * global_scale
|
||||||
if (elem_props_get_bool(fbx_props, b'UseDepthOfField', False)):
|
if (elem_props_get_bool(fbx_props, b'UseDepthOfField', False)):
|
||||||
camera.dof.use_dof = True
|
camera.dof.use_dof = True
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ class PT_VDMBaker(bpy.types.Panel):
|
|||||||
It also has settings for name (image, texture and brush at once), resolution, compression and color depth.
|
It also has settings for name (image, texture and brush at once), resolution, compression and color depth.
|
||||||
"""
|
"""
|
||||||
bl_label = 'VDM Brush Baker'
|
bl_label = 'VDM Brush Baker'
|
||||||
bl_idname = 'Editor_PT_LayoutPanel'
|
bl_idname = 'VDM_PT_bake_tools'
|
||||||
bl_space_type = 'VIEW_3D'
|
bl_space_type = 'VIEW_3D'
|
||||||
bl_region_type = 'UI'
|
bl_region_type = 'UI'
|
||||||
bl_category = 'Tool'
|
bl_category = 'Tool'
|
||||||
|
Loading…
Reference in New Issue
Block a user