THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 07/12/2011 at 15:08, xxxxxxxx wrote:
Cinema 4D Version: Python
HairGuides.SetPoint(id, p) has the same explanation as GetPoints()
"Gets a list of points for the guides."
This is of course wrong.
HairGuides.GetPoints() is also listed twice in the R13 sdk.
Concerning the rest of the SDK and Hair. There's not much there.
There isn't even an explanation on how to create hair objects and guides.
So here's an example I put together:
def main() :
obj = c4d.BaseObject(c4d.Ocube) #Creates a Cube in memory only
doc.InsertObject(obj) #Adds it to the OM
ho = c4d.BaseObject(1017305) #Creates a hair object in memory only
ho[c4d.HAIRSTYLE_LINK]= obj #Puts the cube into the hair's link field
doc.InsertObject(ho) #Adds it to the OM
c4d.DrawViews(c4d.DRAWFLAGS_ONLY_ACTIVE_VIEW|c4d.DRAWFLAGS_NO_THREAD|c4d.DRAWFLAGS_NO_REDUCTION|c4d.DRAWFLAGS_STATICBREAK) #forces redraws
ho = doc.SearchObject("Hair") #Lost the focus upon creation so we need to get it again
guides = ho.GetGuides() #Assign the guides to a variable
gcount = guides.GetCount() #Gets the number of guides
segcount = guides.GetSegmentCount() #Number of segments per guide (number of points is one more than this)
gpcount = guides.GetGuidePointCount() #Gets the number of points per segment.
owner = guides.GetObject() #Gets the guides owner object
pnts = guides.GetPoints() #Gets a list of the points on all of the guides.
guides.SetPoint(17, p= c4d.Vector(0,500,0)) #Moves one of the hair points to this vector position
ho.SetGuides(guides,clone=False) #Error:The object doesn't own the guides!! Really?..Then who does?
I'm not sure what's going on with the SetGuides() function.
In C++ the hair object owns the guides. And the python SDK also says the same thing.
Yet I get an error that the hair object doesn't own the guides in my code.
I'm not sure if that's a real bug. Or another one of those things that's documented clearly.
On 07/12/2011 at 23:29, xxxxxxxx wrote:
Hi, the guides already belong to the hair object. Cheers, Sebastian
On 08/12/2011 at 08:22, xxxxxxxx wrote:
That's kinds of a strange error message. It might be better to change it if possible.
So does that mean that SetGuides() is only supposed to be used within python plugins?
When I change a guide hair's point position with: guides.SetPoint(17, p= c4d.Vector(0,500,0)).
The point doesn't move(update) until I toggle the hair on&off in the OM.
I've tried things like: c4d.DrawViews(c4d.DRAWFLAGS_FORCEFULLREDRAW) but none of them are working for me.