I just found the method "mgLightPointAnimationSequenceSet", would this be a better function for delta string light points?
Unfortunately the Create Light Point tool is not a available to Creator Script. The Create Light Point System tool is, but this is not what you want. The OpenFlight API Developer Guide Volume 1 has a section that discusses everything you need to know about light points. It gives you example c code to set up light points for a run way. This should be very easy to translate into OpenFlight Script and get what you need. Take a look at the section under:
OpenFlight API Developer Guide Volume 1 -> Node Records -> Node Types and Their Attributes -> fltLightPointNodes
See if that gets you off the ground. Once you get your script close, feel free to post it and we can help you with the finishing touches.
Hope this helps!
Chris.
Amazing! This is just what I needed.
-Brian
I had to take a bit of a break from this because of other work, but I feel like I am close.
I am fairly certain that I am not grabbing the color properly. Maybe someone could shed a little light on the example. (bad pun)
MG_NULL is not recognized by Creator's script editor (Python), is there a substitute value for MG_NULL?
The script successfully creates a light point entry when I remove the MG_NULL value, but there are no identifiable light points created.
I have currently commented out the section that makes light points into strings.
db = mgGetCurrentDb()
# LIGHT POINT ANIMATION INDICES
lpNoAnimation = -1
lpStrobeAnimation = 0
lpREILAnimation = 5
# LIGHT POINT APPEARANCE INDICES
lpRwyEdge = 103
# LIGHT POINT COLOR INDICES
lpColorWhite = 66687
lpColorAmber = 66431
lpColorRed = 65663
lpColorGreen = 67199
lpColorBlue = 67455
# LIGHT POINT SPACING
lpSpacingRwyEdge = 200
lpOffsetRwyEdge = 12
# GENERATE LIGHT POINT
# Group
grec = mgNewRec (fltGroup)
mgAttach (db, grec)
# Object
orec = mgNewRec (fltObject)
mgAttach (grec, orec)
# Light Point System
lightPoint = mgNewRec (fltLightPoint)
# Add Light Point to Object
mgAppend (orec, lightPoint)
# Add light point system
#xrec = mgNewRec (fltXmTranslate)
#mgSetCoord3d (xrec, fltXmTranslateFrom, 0.0, 0.0, 0.0)
#mgSetCoord3d (xrec, fltXmTranslateDelta, 0.0, lpSpacingRwyEdge*2.0, 0.0)
#mgAppend (lightPoint, xrec)
# end system
vrec = mgNewRec (fltVertex)
mgSetAttList (vrec, fltVColor, lpColorAmber, fltVIntensity, 5, MG_NULL)
mgSetCoord3d (vrec, fltCoord3d, 0.0, 0.0, 0.0)
mgSetVtxNormal (vrec, 0.0, -1.0, 0.0);
mgAttach (lightPoint, vrec)
MG_NULL is not recognized by Creatorââ¬â¢s script editor (Python), is there a substitute value for MG_NULL?
In the context of mgGetAttList and mgSetAttList you do not need to NULL terminate the var args in Python. It does not hurt to include MG_NULL (or its substitute None) but you don't have to. See reference page for these functions for more information and PYTHON NOTES.
I am fairly certain that I am not grabbing the color properly. Maybe someone could shed a little light on the example. (bad pun)
In your code:
lpColorAmber = 66431
mgSetAttList (vrec, fltVColor, lpColorAmber, fltVIntensity, 5)
You are setting a "Creator Color Index" (66431) when you should be setting a simple "Color Index". Color Indices in the OpenFlight API are in the range 0..1023. That index, combined with the Color Intensity make the "Creator Color Index" which is in the range 0..((1024*128)-1]. The difference in the two "color spaces" is explained in the OpenFlight API Reference FAQ titled:
What is the difference between Color Index/Intensity and Creator Color Index attributes?
Creator Color Index 66431 would be API Color Index 518 I believe (66431/128).
To set the proper color on the vertex, you could use either:
Set the color by "Creator Color Index" (in which case you DO NOT set intensity as intensity is rolled into Creator Color Index):
mgSetAttList (vrec, fltVCreatorColor, lpColorAmber)
or Set the color by Color Index and Color Intensity:
mgSetAttList (vrec, fltVColor, 518, fltVIntensity, 5)
You can't mix the two color spaces.
The script successfully creates a light point entry when I remove the MG_NULL value, but there are no identifiable light points created.
Hmmm... I ran this script in Creator and see a light point created. Am I missing something?
FYI...
This "Creator Color Index" vs "Color Index" topic was recently discussed on this other API Forum Post
support/discussions/topics/2120
The FAQ and this topic should help you understand the two color spaces better.
Terrific, I think I understand the color issue I was having now. You aren't missing anything, the light point is still created, but the script editor throws NameError: name 'MG_NULL' is not defined
What about changing the light point appearance? Can I just use a light point palette index number? How do I change the appearance?
What about changing the light point appearance? Can I just use a light point palette index number? How do I change the appearance?
You are on the right track. The appearance (and animation) of light points are defined in the palette and referenced through index by the light points. You create an appearance using mgNewLightPointAppearance and assign it attributes using mgSetAttList. Also assign light point appearance index to light point using mgSetAttList.
So I could just do mgSetAttList? Would that go like:
mgSetAttList (lightPoint, fltLpAppearanceIndex, 103)
Or should I target the vertex?
So I could just do mgSetAttList? Would that go like:
mgSetAttList (lightPoint, fltLpAppearanceIndex, 103)
Or should I target the vertex?
The OpenFlight Data Dictionary tells you this (which attributes belong to which node types). In this case the appearance index attribute belongs to the light point node type. Check the data dictionary to convince yourself of this ;-)
Thank you, I've got it building perfect strings with correct light point apperances and animations now!
Craig
I am trying to generate a string with delta of runway edge lights between two vertices, the only Light Point creation I could find was mgExecute ("Create Light Point System", None).
I assume that I am supposed to create a paramBlock for this execution, but I don't know what handles to assign. Any help with this would be greatly appreciated!