Still far from being fully fleshed out, but could prove helpful to others in some form possibly. It's totally specific to my needs so I make no claims of it's longevity, stability, or usability for anyone else's needs.
The script prints to the console a tab delimited list of all project objects beginning with a selected object. It then loops downwards through all objects, object parameters, tags, and tag parameters gathering names & values. Choose top most object in your project to get all items in your project.
Here's the code I'm settling on for the moment. I did a few common parameter conversions from numerical value to it's string value seen in the UI.
Example 1: Toggle switches return "Unchecked" / "Checked" instead or 0 / 1
Example 2: Visible in Editor / Renderer return "On" / "Off" / "Default" instead of 0 / 1 / 2
Source code:
#--------------------------------------------------------
# [IN DEVELOPEMENT AND NOT COMPLETED YET]
# Project parameter names and values list script
# 9/2020 David Torno
#--------------------------------------------------------
import c4d
from c4d import gui
# Main function
def main():
o = op
if o is not None:
recurse(o)
def getParamData(o):
try:
#--------------------------------------------------------
# PARAMETER DATATYPE NUMBERS R20 (Likely to change with C4D versions)
# 1 = Group
# 8 = Button
# 12 = String
# 15 = Dropdown
# 133 = Object Link
# 1000481 = Color Gradient
# 1009290 = InExclude List
# 400006001 = Toggle
#--------------------------------------------------------
#misc var
grpName = ""
#Rotation Order conversion
rotOrder = ["XYZ", "XZY", "YXZ", "YZX", "ZXY", "ZYX", "HPB"]
#Vis in editor/renderer conversion
visEditRender = ["On", "Off", "Default"]
#Toggle conversion
tog = ["Unchecked", "Checked"]
#Process tag parameters
desc = o.GetDescription(c4d.DESCFLAGS_DESC_0)
for bc, paramid, groupid in desc:
#print str(paramid[0].id), str(paramid[0].dtype), str(paramid[0].creator)
#-------------------------------------------------------
#Currently checking for default parameter value does not work
#-------------------------------------------------------
#Check if current value matches default value
#is_default = bc[c4d.DESC_DEFAULT] == o[paramid]
#print both values for visual comparison
#print "DEBUG:: " + str(bc[c4d.DESC_DEFAULT]) + " == " + str(o[paramid]) + " --> " + str(is_default)
#if is_default is not True:
#-------------------------------------------------------
isgroup = paramid[0].dtype==c4d.DTYPE_GROUP
if isgroup:
#handle blank names
if bc[c4d.DESC_NAME] is not "":
grpName = bc[c4d.DESC_NAME]
print "\t" + grpName
#check for param name and ident
if bc[c4d.DESC_NAME] and bc[c4d.DESC_IDENT]:
try:
#Adjust color float to 255 range
vec = o[paramid]
if "Color" in bc[c4d.DESC_NAME] and "Vector" in str(vec):
vec = o[paramid]
val = "Vector(" + str(vec[0]*255) + ", " + str(vec[1]*255) + ", " + str(vec[2]*255) + ")"
else:
blank = o[paramid]
if blank == None:
val = ""
else:
val = str(o[paramid])
#Convert toggle value to name str
if str(paramid[0].dtype) == "400006001":
val = tog[o[paramid]]
#Convert dropdown value to name str
if str(paramid[0].dtype) == "15":
if "Visible in " in bc[c4d.DESC_NAME]:
val = visEditRender[o[paramid]]
elif "Rotation Order" == bc[c4d.DESC_NAME]:
val = rotOrder[o[paramid]]
#handle group name duplicates in results
if bc[c4d.DESC_NAME] == grpName or paramid[0].dtype == 8:
pass
else:
print "\t\t" + bc[c4d.DESC_NAME] + "\t" + val
#--------------------------------------------------------------------
#DEBUG print reveals parameter data type enumeration
#--------------------------------------------------------------------
#print "DTYPE:" + str(paramid[0].dtype) + "\t\t" + bc[c4d.DESC_NAME] + "\t" + val
except:
print "\t\t" + bc[c4d.DESC_NAME] + ": PARAMETER REQUIRES MANUAL EXTRACTION"
#--------------------------------------------------------------------
#DEBUG print reveals parameter data type enumeration
#--------------------------------------------------------------------
#print "DTYPE:" + str(paramid[0].dtype) + "\t\t" + bc[c4d.DESC_NAME] + ": PARAMETER REQUIRES MANUAL EXTRACTION"
except:
print "--UNKNOWN PARAMETER--"
def recurse(o):
obj = o
if obj is not None:
#Misc variables
tab = "\t"
#Header
#print "Name\tParameter\tValue\tParam ID"
#Print object name
on = obj.GetName()
print on
#Get param name and value
getParamData(obj)
#Get object tags
tags = obj.GetTags()
#Loop tags
for t in tags:
tn = t.GetTypeName()
if tn is not "" or None:
#Add spacer in output
print ""
#Get tag name
print t.GetTypeName()
#Get param name and value
getParamData(t)
#Check for child object
d = obj.GetDown()
if d is not None:
recurse(d)
#Get next object
n = obj.GetNext()
if n is not None:
recurse(n)
else:
print "Error: Select one starting object first."
# Execute main()
if __name__=='__main__':
main()
Example output:
Right fill light
Basic Properties
Name Right fill light
Layer
Visible in Editor Off
Visible in Renderer Default
Use Color 0
Display Color Vector(255.0, 255.0, 255.0)
Enabled Checked
X-Ray Unchecked
Icon Color Unchecked
Coordinates
Position Vector(337.76, 0, -211.712)
Scale Vector(1, 1, 1)
Rotation Vector(1.326, 0, -1.571)
Rotation Order HPB
Quaternion
Quaternion Rotation Unchecked
Freeze Transformation
Frozen Position Vector(0, 0, 0)
Frozen Scale Vector(1, 1, 1)
Frozen Rotation Vector(0, 0, 0)
Global Position Vector(337.76, 0, -211.712)
Global Rotation Vector(1.326, 0, -1.571)
Transformed Position Vector(337.76, 0, -211.712)
Transformed Scale Vector(1, 1, 1)
Transformed Rotation Vector(1.326, 0, -1.571)
Object Properties
General
Color Vector(153.765, 216.8775, 229.5)
Use Temperature Unchecked
Color Temperature 6500.0
Intensity 0.65
Type 8
Shadow 2
Visible Light 0
No Illumination Unchecked
Show Illumination Checked
Ambient Illumination Unchecked
Show Visible Light Checked
Diffuse Checked
Show Clipping Checked
Specular Checked
Separate Pass Unchecked
GI Illumination Checked
Export to Compositing Checked
Details
Use Inner Value Checked
Inner Angle 0.0
Inner Radius 0.0
Outer Angle 0.523598775598
Outer Radius 600.0
Aspect Ratio 1.0
Contrast 0.0
Shadow Caster Unchecked
Area Shape 1
Object
Size X 1200.0
Size Y 1200.0
Size Z 200.0
Falloff Angle 3.14159265359
Infinite Angle 0.00872664625997
Samples 40
Add Grain (Slow) Unchecked
Show in Render Unchecked
Show as Solid in Viewport Unchecked
Show in Specular Checked
Show in Reflection Unchecked
Visibility Multiplier 1.0
Falloff 0
Falloff Inner Radius 0.0
Falloff Radius / Decay 500.0
Colored Edge Falloff Unchecked
Z Direction Only Unchecked
Use Gradient Unchecked
Color <c4d.Gradient object at 0x000000D7967B9570>
Use Near Clipping Unchecked
Near Clipping from 0.0
Near Clipping to 10.0
Use Far Clipping Unchecked
Far Clipping from 90.0
Far Clipping to 100.0