-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Open Image Relative Path failing - New Try #269
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this! Looks good to me, just a couple of nits and also there are some formatting issues, please run python ./check_style.py
and fix those to keep the code format consistency.
def draw(self, context): | ||
layout = self.layout | ||
|
||
def draw(self, context): #this def is obsolete, bc. target_property is hidden by default now and relative_path is displayed by default anyways |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this is not required anymore in any of the supported Blender versions, I think we can safely remove it.
def execute(self, context): | ||
dirname = os.path.dirname(self.filepath) | ||
|
||
#dirname = os.path.dirname(self.filepath) #dirname fails if path selected in the Blender File View is relative (starts with //) on Windows |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment can be removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
check_style finds a few issues in other files as well, want me to fix that?
Thanks perfect, thanks! |
We cleaned up the chaos by creating a new branch. The behaviour should match the previous behaviour now, let's call it "intuitive".
class OpenImage(Operator)
fails when using the default 'relative_path' property (True) on Windows. Python os.path.join on Windows does not recognize '//' to be the beginning of a directory and treats it like a filename.
We fixed that error and made the file browser start where the previous image was located. We also modified the dedfault location of the File Viewer to either:
a) Start where a file was selected the last time the File View was used or:
b) if an image had been previously assigned to the target_property, the File View will start with that image selected.
This is Blender's default behaviour
It probably failed when selecting an image for a reflection probe as well and should be working everywhere now.