Maniphest T76656

.WRL imports without material fix
Closed, ArchivedPATCH

Assigned To
Ankit Meel (ankitm)
Authored By
Adam (adammak)
May 11 2020, 10:08 PM
Tags
  • Add-ons (Community)
Subscribers
Adam (adammak)
Ankit Meel (ankitm)
Germano Cavalcante (mano-wii)

Description

System Information
Operating system: Windows 10 Pro 64-bit
Graphics card: NVIDIA GeForce RTX 2070

Blender Version
Broken: 2.8+
.wrl file import does not show colors.
Working: 2.79

Short description of error
The cause of that is return in 2699th line of code in import_x3d.py which returns the method. Moreover, the color vectors need alpha value to be added.
fix:

def appearance_CreateMaterial(vrmlname, mat, ancestry, is_vcol):
    bpymat = bpy.data.materials.new(vrmlname)
    diff_color = mat.getFieldAsFloatTuple('diffuseColor', [0.5, 0.5, 0.5, 1], ancestry)
    
    if(len(diff_color) == 3):
        # .wrl does not have alpha, we need to add 4th element
        diff_color = diff_color+[1]
    bpymat.diffuse_color = diff_color

    bpymat.specular_color = mat.getFieldAsFloatTuple('specularColor', [0.0, 0.0, 0.0], ancestry)

    if False and is_vcol:
        bpymat.use_vertex_color_paint = True
    return bpymat

Revisions and Commits

rBA Blender Add-ons
D12399

Event Timeline

Adam (adammak) created this task.May 11 2020, 10:08 PM
Adam (adammak) updated the task description.
Germano Cavalcante (mano-wii) added a subscriber: Germano Cavalcante (mano-wii).May 11 2020, 10:21 PM

Is this a suggestion to fix T71232?
If so, you should submit a diff through the https://developer.blender.org/differential/diff/create/
or just add a comment there.

Adam (adammak) updated the task description.May 11 2020, 10:35 PM
Adam (adammak) added a comment.May 11 2020, 11:08 PM
In T76656#929238, @Germano Cavalcante (mano-wii) wrote:

Is this a suggestion to fix T71232?
If so, you should submit a diff through the https://developer.blender.org/differential/diff/create/
or just add a comment there.

Thanks! i did that, i know this might not be right place to ask, but should i specify a reviewers for it or i don't have to?

Ankit Meel (ankitm) closed this task as Archived.May 12 2020, 9:02 AM
Ankit Meel (ankitm) claimed this task.
Ankit Meel (ankitm) changed the subtype of this task from "Report" to "Patch".
Ankit Meel (ankitm) added a subscriber: Ankit Meel (ankitm).

Thanks for the patch, I'd add reviewers.

Bastien Montagne (mont29) added a commit: rBA0573bc7daeb1: Fix T71232: .X3D/.WRL imports without materials and textures.Oct 27 2021, 12:27 PM