Protecting custom transform node from optimize scene size

hi community
I am working with some transform nodes with custom attributes.....
created with the createNode command
So the problem is that every time i run optimize scene size the nodes will be deleted.
so my question is how can i protect the nodes?

or could i use another node type because the node has to be visible in outliner and has to have child objects....

every time i run optimize scene size the nodes will be deleted.

That would be because everything not related to shape has no meaning to core maya. The real question is if you really need a custom workflow like this then why dont you make a new optimize command?

Yeah I think building a new optimize command takes to much time...
so I will work with locked nodes and unlock them if i need to...
thx

You could always connect up the 'meaningless' transform nodes, with a message attribute to a more meaningfull object in the scene.

in python:

import maya.cmds as mc

mc.addAttr('meaninglessNull', longName='myMessage', attributeType='message')
mc.addAttr('meaningfullSphere', longName='myMessage', attributeType='message')
mc.connectAttr('meaninglessNull.myMessage', 'meaningfullSphere.myMessage')
=========

now when you optimize your scene, it will keep your meaninglessNull there. In the attrEditor in the extraAttributes dropdown you can see the meaninglessNull and the meaningfullSphere are now connected as friends. 

Hey thats nice! Because i am using a root node for the script, I could create this Root node as an hidden mesh and connect all child nodes to an attribute of the root node!
That sounds perfect for my needs!
Thx a lot!