Cleaning attributes on FBX import.

   2304   6   0
User Avatar
Member
179 posts
Joined: Aug. 2018
Online
Guys,
As a new user I've been having a real problem applying materials to FBX imports.

I then realised there was a 'shop_materialpath' attribute ('Level 1' being the value) on the fbx import.
How can I clear this globally - at the OBJECT level? AFAIK I can only connect nodes such as 'atribute delete,' or 'clean geo' node at the GEO level?
Or alternatively how can I do it en-mass with the 400+ nodes in my subnet?

Or is there a better way to approach this?
Edited by Mike_A - Aug. 5, 2022 14:52:23
User Avatar
Member
7761 posts
Joined: Sept. 2011
Online
Use python to loop through the nodes imported by the fbx and append an attribute delete node to the render sop for each geo node in the fbx
User Avatar
Member
179 posts
Joined: Aug. 2018
Online
Thanks. Unfortunately I've no idea how to program in Python.
User Avatar
Member
8545 posts
Joined: July 2007
Online
select your FBX object subnet(s) that contains the imported fbx objects and paste this into python shell or create shelf button out of this

nodes = hou.selectedNodes()
for fbx_subnet in nodes:    
    if fbx_subnet.type().nameWithCategory() != "Object/subnet":
        print("Skipping {}, not a valid Object subnet".format(fbx_subnet.path()))
        continue
    
    for node in fbx_subnet.children():
        if node.type().name() == "geo":
            render_node = node.renderNode()
            mat_attrib = render_node.geometry().findPrimAttrib("shop_materialpath")
            if mat_attrib:
                ad = render_node.createOutputNode("attribdelete")
                ad.parm("primdel").set("shop_materialpath")
                ad.moveToGoodPosition()
                if node.renderNode() == node.displayNode():
                    ad.setDisplayFlag(1)
                ad.setRenderFlag(1)
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
7761 posts
Joined: Sept. 2011
Online
tamte
select your FBX object subnet(s) that contains the imported fbx objects and paste this into python shell or create shelf button out of this

how kind
User Avatar
Member
179 posts
Joined: Aug. 2018
Online
tamte
select your FBX object subnet(s) that contains the imported fbx objects and paste this into python shell

Tomas,
Many thanks for this, I very much appreciate your time, generosity and expertise. It solves the problem.

Having done some further investigation my suspicion is that the issue lies with the fbx file itself. Having done an 'import-re-export' with another application, the problem doesn't seem to occur. With the original fbx, despite being imported 'geometry only' - no materials, it seems it was triggering H to generate a shop_materialpath attribute for no obvious reason.

Your script will be very helpful if we come across this issue again.

With thanks,

Mike A.
Edited by Mike_A - Aug. 6, 2022 10:51:15
User Avatar
Member
179 posts
Joined: Aug. 2018
Online
Issue confirmed by Sidefx as a bug - ID# 123352.
  • Quick Links