Jump to content

BJS-exporter automatic texture baking fails


javalang
 Share

Recommended Posts

HI everyone,

my "miniexport" of a simple unwrapped model lacks in automatic texture baking, which should be possible if using cycles render.

Quote

texture baking will be automatic when:

  • cycles render is the current render engine,
  • procedural textures are used.

So there is the questions:

What are blender procedural textures (are this the cycles nodes from the popup-menu "Texture" , like Voronoi etc. ) ?

What I'm doing wrong? 

PS: I understand "automatic texture baking" in the sense of no manual baking and saving to disc, but exporter will do this or exports inline if this option was checked.

Cheers

 

Link to comment
Share on other sites

Answering myself,

ohhh, this is a bad pitfall :(

BJS-Exporter V5.4.0 is checking the blender version via existence of a layout label named "UV Editing". This is an user definable label, if someone has modified this label or is using a very common extension like Sensei-Format  which uses another layout schemes, the exporter fails even if the newest blender version is used.

That is really bad, the check should be something like "if bVersion ..." (variable already initialized in the script).

So, for a first workaround, be sure your blender startup-file has a layout named "UV Editing", then the Images from Cycles render will be automatically generated.

Hope this helps...

 

Link to comment
Share on other sites

I do not follow. bVersion is assigned as a result of a call to blenderMajorMinorVersion() from the file package_level.py, shown below:

def blenderMajorMinorVersion():
    # in form of '2.77 (sub 0)'
    split1 = app.version_string.partition('.') 
    major = split1[0]
    
    split2 = split1[2].partition(' ')
    minor = split2[0]
    
return float(major + '.' + minor)

The "UV Editing" screen is only used for baking procedure textures (noise, Voronoi) from the internal render.  Yes, that is not really great, but as far as I could find out there is no "bake" API call like for Cycles

Link to comment
Share on other sites

@JCPalmer Yes you're right, this is for the procedural textures only as I mentioned in the first message of this thread.

the problematic spot is here:

        # check for really old .blend file, eg. 2.49, to ensure that everything requires exists
        if self.needsBaking and bpy.data.screens.find('UV Editing') == -1:
            Logger.warn('Contains material requiring baking, but resources not available.  Probably .blend very old', 2)
            
            self.needsBaking = False

Changing this check using

if self.needsBaking and (bpy.app.version[0]*1000+ bpy.app.version[1])<2049:

helps in my case, but of course it's much easier to add a new layout "UV Editing"  :). Anyway,  it's a charm to generate these synthetic textures 'on the fly' now.

There is another position where the string "UV Editing " appears, but it's not affecting my scenario.:

def bakeInternal(self, bake_type, image, uvName, extension):
....
        # assign the image to the UV Editor, which does not have to shown
        bpy.data.screens['UV Editing'].areas[1].spaces[0].image = image

 

@Deltakosh

As I don't know exactly what this piece code does (maybe it's for Blender-Render only), I leave the code as it is until someone knows what to do. But in the meantime giving a hint in the docu would be great for other people...

Nevertheless, thank you all for this really fantastic module,

cheers Hans

 

Link to comment
Share on other sites

ah, I forgot about this.  This is not really checking your version of Blender, as the preceding comment says.  It is attempting to determine what version of Blender saved the .blend file.  Right now the 5.4 exporter refuses to run on a version of Blender less than 2.76, so this check would never get triggered.

This check was put in when baking was added.  Someone got a really old .blend from BlendSwap, specifically 2.49.  Unfortunately, I could not find where you can determine this.  Anyway, back then there was either no such window or it had a different name back then.

Perhaps, a custom function which detected something else that a UV Editor window had would be better.  It could be used for this check as well as internal baking.  Found this on the screen class.  Perhaps, the UV editor always returns True for use_play_image_editors , like:

def findUVEditor(self):
    for screen in bpy.data.screens:
        if screen.use_play_image_editors: return screen

    return None

Either way, I do not plan on trying to fix some ancient thing.  The way you can fix this is to create a NEW scene, and File->Append the stuff from the old .blend

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...