PDA

View Full Version : Refs struct in 2011 & 2012


JHN
07-04-2011, 12:28 AM
As I'm mostly in 2010, I can't use it, but in 2011 and 2012 there's new (undocumented) options to the refs struct.

#Struct:refs(
getReference:<fn>; Public,
DependencyLoopTest:<fn>; Public,
getIndirectReference:<fn>; Public,
dependentNodes:<fn>; Public,
getNumRefs:<fn>; Public,
getNumIndirectRefs:<fn>; Public,
dependents:<fn>; Public,
setIndirectReference:<fn>; Public,
replaceReference:<fn>; Public,
dependsOn:<fn>; Public)


A snippet to accompany it (provided by Larry Minton on the 2011 beta I was on) :


fn dumpRefHierachy ref indent:"" =
(
if ref != undefined do
(
local nrefs = refs.getnumrefs ref
if nrefs != 0 do
(
format " %========== Direct References =============\n" indent
local subIndent = indent += " "
for i = 1 to nrefs do
(
local subRef = refs.getReference ref i
format "%% : %\n" indent i subRef
dumpRefHierachy subRef indent:subIndent
)
)
local nirefs = refs.getNumIndirectRefs ref
if nirefs != 0 do
(
format " %========== Indirect References =============\n" indent
local subIndent = indent += " "
for i = 1 to nirefs do
(
local subRef = refs.getIndirectReference ref i
format "%% : %\n" indent i subRef
dumpRefHierachy subRef indent:subIndent
)
)
)
)
dumpRefHierachy $

As I haven't seen it mentioned before, I thought I'd post this here. I have not used this new tools myself and really haven't taken a good look, but maybe it's of help to someone on 2011/2012.

-Johan

PEN
07-04-2011, 09:26 PM
I have yet to use it as well. Thanks for posting as I forgot that this was added so I might need it at some point, could you post it again at that time as I'm sure to forget again:S

CGTalk Moderation
07-04-2011, 09:26 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.