Get last object added to document?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 07/03/2008 at 08:43, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   R9-R10.5 
    Platform:   Windows  ; Mac  ;  Mac OSX  ; 
    Language(s) :     C++  ;

    ---------
    Unfortunately, an object is being created via a CallCommand() to 'Convert from Spline' and the Hair object that results isn't obvious (there may be more than one Hair object in the document). Is there any way to get the last object added to the document?

    Currently, I'm considering an unpleasant method:

    1. Store all current objects in an AtomArray.
    2. CallCommand().
    3. Compare every object in AtomArray to every object in the document to see which one isn't in the AtomArray.

    Overkill doesn't begin to describe this procedure (step 3 particularly). AtomArray::Find() may prove useful here - as long as I do some extra checks for veracity (is the unfound object actually a Hair object, e.g.).

    Thanks,



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 09/03/2008 at 07:19, xxxxxxxx wrote:

    R10 SDK plugin folder, c4d_strings.str file...

        
        
        
        
         IDS_HAIR_DEFOMER_EXAMPLE "Hair SDK - Comb Deformer";  
         IDS_HAIR_FORCE_EXAMPLE  "Hair SDK - Object Force";  
         IDS_HAIR_COLLIDER_EXAMPLE "Hair SDK - Collider Object";  
         IDS_HAIR_CONSTRAINT_EXAMPLE "Hair SDK - Constraint";  
         IDS_HAIR_GRASS_EXAMPLE  "Hair SDK - Grass";  
         IDS_HAIR_SHADER_EXAMPLE  "Hair SDK - Shader";  
         IDS_HAIR_VIDEOPOST_EXAMPLE "Hair SDK - Videopost";  
         IDS_HAIR_STYLING_EXAMPLE "Hair SDK - Styling";  
         IDS_HAIR_RENDERING_EXAMPLE "Hair SDK - Render Modifier";  
          **IDS_HAIR_GENERATOR_EXAMPLE  "Hair SDK - Generator Object";**  
        
    

    ...maybe the answer lies in this elusive "Hair SDK" :)



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 09/03/2008 at 14:59, xxxxxxxx wrote:

    I'm not sure what you are on about. (?) ;)

    I'm not making a plugin Hair object, I'm just converting an imported SplineObject into a HairObject (standard C4D Hair object - no more plugins, tyvm). All of the SDK Hair examples (all of them) are about making your own Hair plugins using the Hair SDK (Hair Object, Tag, VideoPost, etc.).

    It is sooo complex to set this stuff up (the Hair Mat, Hair Texture Tag, Hair Render effect, ...) that I found a quick-and-dirty (and completely compliant) way to do it: Convert the Spline to Hair; Add a new Hair object; move the tags from the new Hair object to the converted Hair object; remove the new Hair object. Now the Material, Texture Tag, and even the Hair Render are all setup without grueling code. ;P



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 09/03/2008 at 15:59, xxxxxxxx wrote:

    Quote: Originally posted by kuroyume0161 on 09  March 2008
    >
    > * * *
    >
    > I'm not sure what you are on about. (?) ;)
    >
    >
    > * * *
    Your post was asking how to determine which object was created, when you sent a menu command to create it.  My speculative suggestion was that if you (we) had the Hair sample/SDK source code, you might be able to create the hair object directly, instead of using issueing the ("Convert from Spline") menu command. :)



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 09/03/2008 at 16:49, xxxxxxxx wrote:

    Nope. To create a standard Hair object, you can just do this:

    HairObject* hobj = HairObject::Alloc();

    But I have no idea how to convert the SplineObject segments/points into HairObject guides (and I'd rather not deal with it at that level if possible). Cinema 4D already does it for me - but with that one caveat. :)


Log in to reply