Maniphest T80157

The view_settings.look value show strange on different computer
Closed, Archived

Assigned To
Richard Antalik (ISS)
Authored By
yonghao lv (Atticuslv)
Aug 27 2020, 11:31 AM
Tags
  • BF Blender
Subscribers
Raimund Klink (Raimund58)
Richard Antalik (ISS)
yonghao lv (Atticuslv)

Description

System Information
Operating system: Windows-10-10.0.18362-SP0 64 Bits
Graphics card: GeForce RTX 2080 SUPER/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 442.92

Blender Version
Broken: version: 2.83.5, branch: master (modified), commit date: 2020-08-19 06:07, hash: rBc2b144df395f
Worked: 2.83.5,2.9,2.91

Short description of error
bpy.context.scene.view_settings.look is not the same value on different computer

Exact steps for others to reproduce the error
use print(bpy.context.scene.view_settings.look) to check the value on different PC. Both version are 2.83.5
PC 1


PC 2

Event Timeline

yonghao lv (Atticuslv) created this task.Aug 27 2020, 11:31 AM
Raimund Klink (Raimund58) added a subscriber: Raimund Klink (Raimund58).Aug 27 2020, 11:39 AM

Not sure what you are trying to do. Could you provide a small and simple test .blend?

yonghao lv (Atticuslv) added a comment.Aug 27 2020, 12:20 PM
In T80157#1003627, @Raimund Klink (Raimund58) wrote:

Not sure what you are trying to do. Could you provide a small and simple test .blend?

I write a addon to control the view of the view_setting.look and sent it to my friend .but it crash .
I check the info and find that the value of bpy.context.scene.view_settings.look show different on his PC.
On my pc ,it was strings like "Medium Contrast" ,but on my friends'PC(I send it to different guys later,but the same result) , it give both color space and looks in the string: "Filmic - Medium Contrast "
So why give a different value when only access the value of looks

Raimund Klink (Raimund58) added a comment.Aug 27 2020, 12:33 PM

Hm, okay. Could you maybe provide a script snippet that I can throw into my Blender to confirm/reproduce your problem?
I mean, how should the developers reproduce your error?

yonghao lv (Atticuslv) added a comment.Aug 27 2020, 12:50 PM
In T80157#1003678, @Raimund Klink (Raimund58) wrote:

Hm, okay. Could you maybe provide a script snippet that I can throw into my Blender to confirm/reproduce your problem?
I mean, how should the developers reproduce your error?

maybe you can try to run this operator...It work well on my PC.
but the easy way to show the error is to print it.(I am not sure what cause this problem,but can only display it)

print(bpy.context.scene.view_settings.look)

operator:wheel up and down to switch looks,left to confirm,right to cancel

import bpy

Looks = ['Very Low Contrast', 'Low Contrast', 'Medium Contrast',
         'Medium High Contrast', 'High Contrast', 'Very High Contrast', 'None']


class LightCheck(bpy.types.Operator):
    """Check the tooltips that show on the left"""
    bl_idname = "view.light_check2"
    bl_label = "LightCheck2"
    bl_options = {'REGISTER', 'UNDO'}

    mode: bpy.props.IntProperty()
    originLook: bpy.props.StringProperty()

    def modal(self, context, event):
        if event.type == "WHEELUPMOUSE":
            self.mode -= 1
            if self.mode < 0:
                self.mode = 6
            context.scene.view_settings.look = Looks[self.mode]

        elif event.type == "WHEELDOWNMOUSE":
            self.mode += 1
            if self.mode > 6 :
                self.mode = 0
            context.scene.view_settings.look = Looks[self.mode]

        elif event.type == 'F' and event.value == 'PRESS' :
            if context.scene.view_settings.view_transform != 'False Color':
                context.scene.view_settings.view_transform = 'False Color'
            else:
                context.scene.view_settings.view_transform = 'Filmic'
            return {'RUNNING_MODAL'}

        elif event.type == 'LEFTMOUSE':
            self.report({'INFO'}, f'Contrast Looks Confirm as: " {context.scene.view_settings.look} "')
            # bpy.types.SpaceView3D.draw_handler_remove(self._handle, 'WINDOW')
            return {'FINISHED'}

        elif event.type in {'RIGHTMOUSE', 'ESC'}:
            context.scene.view_settings.view_transform = self.viewtrans
            context.scene.view_settings.look = self.originLook
            # bpy.types.SpaceView3D.draw_handler_remove(self._handle, 'WINDOW')
            return {'CANCELLED'}

        return {'RUNNING_MODAL'}

    def invoke(self, context, event):
        # false color
        # set
        self.mode = Looks.index(context.scene.view_settings.look)
        self.originLook = context.scene.view_settings.look
        self.viewtrans = context.scene.view_settings.view_transform
        # modal / draw
        # args = (self, context)
        # self._handle = bpy.types.SpaceView3D.draw_handler_add(draw_looks_callback_px, args, 'WINDOW', 'POST_PIXEL')
        context.window_manager.modal_handler_add(self)

        return {'RUNNING_MODAL'}


def register():
    bpy.utils.register_class(LightCheck)


def unregister():
    bpy.utils.unregister_class(LightCheck)


if __name__ == "__main__":
    register()
Richard Antalik (ISS) closed this task as Archived.Aug 27 2020, 1:47 PM
Richard Antalik (ISS) claimed this task.
Richard Antalik (ISS) added a subscriber: Richard Antalik (ISS).

Short description of error
bpy.context.scene.view_settings.look is not the same value on different computer

This value is saved in file, so unless you test operator on exact same file (unchanged) , output may not be the same. Also you can have custom color profiles installed.
This error probably happened on file saved with Blender 2.79. This is not a bug in Blender itself.

I would recommend to reach for help at one of the community websites: https://www.blender.org/community/
Closing as this bug tracker is only for bugs and errors.

Raimund Klink (Raimund58) added a comment.Aug 27 2020, 1:48 PM

When I run in the Python Console

print(bpy.context.scene.view_settings.look)

I get

None

(Blender 2.83.5)

yonghao lv (Atticuslv) added a comment.Aug 27 2020, 1:55 PM
In T80157#1003702, @Richard Antalik (ISS) wrote:

Short description of error
bpy.context.scene.view_settings.look is not the same value on different computer

This value is saved in file, so unless you test operator on exact same file (unchanged) , output may not be the same. Also you can have custom color profiles installed.
This error probably happened on file saved with Blender 2.79. This is not a bug in Blender itself.

I would recommend to reach for help at one of the community websites: https://www.blender.org/community/
Closing as this bug tracker is only for bugs and errors.

but they are using an empty file to test it .
I mean, when we both set the looks to "Medium Contrast",
print(bpy.context.scene.view_settiing.look) give him the value "Flimic - Medium Contrast ", and give me the value "Medium Contrast". What make the difference?

Richard Antalik (ISS) added a comment.Aug 27 2020, 2:24 PM

I would need more information like what version does he use, or check if this happens when you(both) click on File > Defaults > Load Factory Settings.
It may be possible that startup file or some preference got ported from 2.79 when running Blender after installation.

I am not sure what you want to achieve with your addon - like share with one person or with the world, but in second case you simply need to consider that you may get unexpected input and you must sanitize these cases. Perhaps throw error, or just do something that is considered to be safe action.

But as I said, this tracker is only for bugs. To report a bug you need to have reproducible case that always fails, so when we test it we can look at why it fails and then make fix.

yonghao lv (Atticuslv) added a comment.Aug 27 2020, 2:34 PM

I think that is the point! I just move to blener early this year, so I haven't consider about the setting that got ported from 2.79 and think that is an error.
My friend have use blender for a longtime ,so maybe his startfile comes from 2.79.
I will check it soon.
Thank you Rhichard !