.WRL imports without material fix #76656

Closed
opened 2020-05-11 22:08:15 +02:00 by Adam · 8 comments

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
**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 ```
Author

Added subscriber: @adammak

Added subscriber: @adammak

Added subscriber: @mano-wii

Added subscriber: @mano-wii

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

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

In #76656#929238, @mano-wii wrote:
Is this a suggestion to fix #71232?
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?

> In #76656#929238, @mano-wii wrote: > Is this a suggestion to fix #71232? > 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?
Member

Added subscriber: @ankitm

Added subscriber: @ankitm
Member

Changed status from 'Needs Triage' to: 'Archived'

Changed status from 'Needs Triage' to: 'Archived'
Ankit Meel self-assigned this 2020-05-12 09:02:15 +02:00
Member

Thanks for the patch, I'd add reviewers.

Thanks for the patch, I'd add reviewers.

This issue was referenced by 0573bc7dae

This issue was referenced by 0573bc7daeb1e5fc1e0d0e6a37c5efc043aebb13
Sign in to join this conversation.
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#76656
No description provided.