JHN
01-14-2008, 11:49 AM
I have made some simple property functions for the scene explorer:
/* LAYER NAME */
fn getLayer theNode = (
theNode.layer.name as name
)
SceneExplorerManager.addReadOnlyProperty "Layer Name" getLayer
/* LAYER VISIBILITY */
fn showLayer theNode = (
if theNode.layer.on then 1 else 0
)
fn hideLayer theNode theValue = (
theValue = case theValue of
(
"0" : false
"1" : true
"true" : true
"false" : false
default: true
)
theNode.layer.on = theValue
)
SceneExplorerManager.addProperty "Layer Visibility" showLayer hideLayer
They work... only thing anoying I found the properties can only be string values... If a property function returns a bool, it still shows an string value with true... it would prefer a checkbox. So am I right in thinking that the only way custom properties are evaluated is through strings? That would suck really as you always get quotes around feedback, or you convert it to name which puts a # in front of it... any thoughts...
-Johan
/* LAYER NAME */
fn getLayer theNode = (
theNode.layer.name as name
)
SceneExplorerManager.addReadOnlyProperty "Layer Name" getLayer
/* LAYER VISIBILITY */
fn showLayer theNode = (
if theNode.layer.on then 1 else 0
)
fn hideLayer theNode theValue = (
theValue = case theValue of
(
"0" : false
"1" : true
"true" : true
"false" : false
default: true
)
theNode.layer.on = theValue
)
SceneExplorerManager.addProperty "Layer Visibility" showLayer hideLayer
They work... only thing anoying I found the properties can only be string values... If a property function returns a bool, it still shows an string value with true... it would prefer a checkbox. So am I right in thinking that the only way custom properties are evaluated is through strings? That would suck really as you always get quotes around feedback, or you convert it to name which puts a # in front of it... any thoughts...
-Johan
