ChaosGroup / blender_with_vray_additions

Blender with patches for V-Ray *.vrscene export
Other
28 stars 13 forks source link

Issues with the package nodeitems_utils.py script #260

Closed philstopford closed 5 years ago

philstopford commented 5 years ago

Trying to use SceneCity with this version of blender, I get errors in the console of the form :

location: :-1 Traceback (most recent call last): File "C:\Program Files\Chaos Group\Blender 2.79 (With V-Ray Additions)\2.79\scripts\modules\nodeitems_utils.py", line 131, in draw_node_menu_item for i,item in enumerate(sorted(self.category.items(context), key=lambda t: getattr(bpy.types, t.nodetype).bl_rna.name)): File "C:\Program Files\Chaos Group\Blender 2.79 (With V-Ray Additions)\2.79\scripts\modules\nodeitems_utils.py", line 131, in for i,item in enumerate(sorted(self.category.items(context), key=lambda t: getattr(bpy.types, t.nodetype).bl_rna.name)): AttributeError: 'RNA_Types' object has no attribute 'StaticRoadPortionNode'

and none of the addons entries in its menus are available in the node editor. Nightly builds and 2.79b are fine, so this looks to be specific to the V-ray blender build corresponding to the https://github.com/ChaosGroup/blender_with_vray_additions/commit/5fdbde0235043e090cf032e5d7f0e4eaa4fc2d0e release

philstopford commented 5 years ago

It seems to be related to the icon code in this script. The attached works better. nodeitems_utils.py.txt

philstopford commented 5 years ago

This is still broken. Could you consider checking whether there's something funky in your branch?

philstopford commented 5 years ago

I felt the need to bump this.

poseidon4o commented 5 years ago

@philstopford How do you reproduce this? I can import .obj files without errors.

philstopford commented 5 years ago

This does seem to be working in 706cd8b. It wasn't working for me in 999e565 or earlier. I was testing with basic objects exported to OBJ from various other packages, that all could import them - just blender/Vray was failing.

philstopford commented 5 years ago

Actually, the OBJ comments should go to https://github.com/ChaosGroup/blender_with_vray_additions/issues/261 and I closed that ticket a while back.

The problem with the nodeitems_utils.py script remains - SceneCity is broken with blender/V-ray port.

philstopford commented 5 years ago

To recap the changes in this patched script, which I tested with the 706cd8b install :

def draw_node_menu_item(self, context):
    layout = self.layout.row()
    col = layout.column()
    for item in self.category.items(context):
        item.draw(item, col, context)
    # Original block below simply doesn't work with SceneCity
    '''
    for i,item in enumerate(sorted(self.category.items(context), key=lambda t: getattr(bpy.types, t.nodetype).bl_rna.name)):
        if self.category.split_items is not None:
            if i and i % self.category.split_items == 0:
                col = layout.column()
        item.draw(item, col, context)
    '''

and then there is a built-in assumption that icons exist in the item draw code, which seems to react better with a try/except :

def draw(self, layout, context):
    default_context = bpy.app.translations.contexts.default
    try:
        props = layout.operator("node.add_node", text=self.label, text_ctxt=default_context, icon=self.icon)
    except:
        props = layout.operator("node.add_node", text=self.label, text_ctxt=default_context)
philstopford commented 5 years ago

Just following up on this : https://github.com/ChaosGroup/blender_with_vray_additions/commit/2901eb73122eaf8fe28c4f6e3415666ac9e2ed49 still has the problem

philstopford commented 5 years ago

Bumping again. Has activity ceased for the time being?

poseidon4o commented 5 years ago

@philstopford Unfortunatelly SceneCity is paid and I can't test if the changes will fix it really. Anyway I added them with 9edd2f87fa5e2e000a5ca4f241b034f69214add8 test and write back when you can.

philstopford commented 5 years ago

I'll try and build from source later this week; it looks like there are no automated builds currently being generated by ChaosGroup. I'll let you know how I get on.

poseidon4o commented 5 years ago

Builds are running now, they should appear soon in the nightlies.

philstopford commented 5 years ago

Looks good here - thanks. Build service saved me the trouble :)