Page 2 of 2 FirstFirst 12
Results 16 to 24 of 24

Thread: Accessing keys of a Curve Node

  1. #16
    Quote Originally Posted by Diepgroen View Post
    You are almost there, man! You got at least the Camera.Position.X to work. If you are not reaching the value of the curve node is because of a typo in the name. Because you are putting the literal name yourself it might be incorrect somehow. Don't know for sure. But looking at the image i posted before there is a double dot (..) in the name.

    Might that be causing trouble?
    I tried the wildest combinations , some made Layout crash but still nothing. GE_AttachExpression should take Channel ID as a parameter which I have but that doesn't work either.

    edit:
    Only GE_CreateExpression works. AttachExpression doesn't.
    Last edited by bazsa73; 03-26-2017 at 11:39 AM.

  2. #17
    Registered User Diepgroen's Avatar
    Join Date
    Jul 2016
    Location
    Amsterdam
    Posts
    36
    Quote Originally Posted by bazsa73 View Post
    I tried the wildest combinations , some made Layout crash but still nothing. GE_AttachExpression should take Channel ID as a parameter which I have but that doesn't work either.

    edit:
    Only GE_CreateExpression works. AttachExpression doesn't.
    You might be right, maybe it's something not obvious at all. One thing is clear you have a few variables to account for: sname, sexpression, schannelname, sexpressionname, xchannelid, 5 of them. tricky

  3. #18
    Registered User Diepgroen's Avatar
    Join Date
    Jul 2016
    Location
    Amsterdam
    Posts
    36
    Quote Originally Posted by bazsa73 View Post
    GE_AttachExpression should take Channel ID as a parameter
    Wait GE_AttachExpression should only take schannelname sexpressionname, not the id

  4. #19
    I try it with a different object with a simpler name. Must exist a some solution to it.

  5. #20
    Quote Originally Posted by Diepgroen View Post
    Wait GE_AttachExpression should only take schannelname sexpressionname, not the id
    https://books.google.hu/books?id=czr...ession&f=false
    looky, on page 537 the note with small typo, the author explains smg about "" charactert, but is it still valid in python?

  6. #21
    Registered User Diepgroen's Avatar
    Join Date
    Jul 2016
    Location
    Amsterdam
    Posts
    36
    Quote Originally Posted by bazsa73 View Post
    https://books.google.hu/books?id=czr...ession&f=false
    looky, on page 537 the note with small typo, the author explains smg about "" charactert, but is it still valid in python?

    Thank you for confusing me further with LScript I think you found what's causing the error. Spaces!!!! You are not using spaces in your GE_Create, but you do use spaces in your GE_Attach. which surely is the source.
    What I can see is that strExp (book example) is a string variable with spaces in it. And the autor does say if expressions, names and channelnames have spaces use double quote characters. How this translates to Python i don't really know.

    What your actually doing i think is this (GE_AttachExpression schannelname badvariable badvariable sexpressionname) if i compare Your "PalaceWindowsOnly:Layer2.Curve (1).Alpha.Key (1).Pos" it has 2 spaces in Curve (1) and Key (1). Could that be the problem?

  7. #22
    Sorry for confusing but actually a commandinput command is a short Lscript and there is scarce references on this topic throughout the interweb.
    I dont know what is the problem but it works with an ordinary channel like Camera.Position.X. I tested it, I can even display a channel in the graph editor but these
    cumbersome subchannels do not want to cooperate. Strange thing. Maybe I should report this to the developers.

  8. #23
    Quote Originally Posted by bazsa73 View Post
    AttachExpression doesn't.
    It does, it just for some reason requires quotes where you don't expect them.

    Example: This script works. It takes your selected item and makes the Y channel affect the bank channel (move the object up or down after running this script to see the effect).

    Code:
    import lwsdk
    
    # LW ID as seen by python script
    UserSelection = lwsdk.LWInterfaceInfo().selected_items()[0]
    
    # LW Hexadecimal identifier, used in commands
    UserSelectionID = lwsdk.itemid_to_str(UserSelection)
    
    # Name of the item as seen by the user.
    UserSelectionName = lwsdk.LWItemInfo().name(UserSelection)
    
    # CreateExpression format:
    # GE_CreateExpression NameOfExpression Expression
    # GE_AttachExpression "ChannelYouWantToAffect" NameOfExpression
    
    lwsdk.command("GE_CreateExpression z" + UserSelectionID + " Value + [" + UserSelectionName + ".Position.Y]*100")
    lwsdk.command("GE_AttachExpression \"" + UserSelectionName + ".Rotation.B\" " + "z" + UserSelectionID)
    
    # These print statement shows the syntax of the create/attach expression commands without variable placeholders.
    # It is very strict, any errors will result in either crashing or nothing happening.
    
    # Also, notice I put the letter "Z" in front of the ID name, as expression names cannot consist entirely of numbers.
    print "GE_CreateExpression z" + UserSelectionID + " Value + [" + UserSelectionName + ".Position.Y]*100"
    print "GE_AttachExpression \"" + UserSelectionName + ".Rotation.B\" " + "z" + UserSelectionID
    Professional-level 3d training: Ryan's Lightwave Learning
    Plugin Developer: RR Tools for Lightwave
    IKB manual

  9. #24
    Hello Ryan, thanks for stopping by. I just wonder how to attach script to a channel with this name: [Unweldbox.Curve (1).Alpha.Key (2).Pos]
    Ordinary transform channels are working for me too. I can attach a script to a Position channel without problem but not to the this Curve node Key.

Page 2 of 2 FirstFirst 12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •