In keyframe, can you set object as invisible and then visible?

Hi all,

I'm creating a quick animation where a bunch of cloth drop on a news presenter (its the Dforce Thrash set). 

I have this issue, where a first batch of cloth drop from above (this part is ok). Thats done, then there is a pause. And another shirt drop on her. 

I cannot put the shirt super high and wait for the simulation for the first batch to finish (it will hit each other and explode). Just wondering if there is an option to make an object to stay invisible until required.

I describe this issue I have in more detail in the private video below. Just hope someone can check it out when you have the time.

 

https://youtu.be/E55ESfCwbcs

Comments

  • macleanmaclean Posts: 2,438

    Found it!! I had to hunt through my files for this script without knowing its name. I'm not even sure it's the answer, but it might be worth a try.

    I had a similar issue last year when I was doing some ERC and couldn't get Visibility to work as a linked property. Richard Haseltine came up with the answer, which was that Visibilty isn't animatable by default. You have to apply this script first, then it can be linked and will work.

    Caveat - This worked in my situation, but I make no guarantees.

    var item = Scene.getPrimarySelection();if ( item ) {	var vis = item.findPropertyByLabel( "Visible" );	if ( vis ) {		vis.setCanAnimate( true );	}}

    Save that as a .dsa then put it in content and apply it like a normal preset. Once Visibilty is animatable, you should be able to set it in the timeline.

    All credit to Richard Haseltine for this script. I hope it actually helps.

  • RurisRuris Posts: 123
    maclean said:

    Found it!! I had to hunt through my files for this script without knowing its name. I'm not even sure it's the answer, but it might be worth a try.

    I had a similar issue last year when I was doing some ERC and couldn't get Visibility to work as a linked property. Richard Haseltine came up with the answer, which was that Visibilty isn't animatable by default. You have to apply this script first, then it can be linked and will work.

    Caveat - This worked in my situation, but I make no guarantees.

    var item = Scene.getPrimarySelection();if ( item ) {	var vis = item.findPropertyByLabel( "Visible" );	if ( vis ) {		vis.setCanAnimate( true );	}}

    Save that as a .dsa then put it in content and apply it like a normal preset. Once Visibilty is animatable, you should be able to set it in the timeline.

    All credit to Richard Haseltine for this script. I hope it actually helps.

    Hi, Whoa, really impressed with your solution. Will try it as soon as I get back. I was thinking this question would be too odd.
  • RurisRuris Posts: 123

    Hi,

    I retyped the code since its a screenshot, hope I got it right.

    Steps to recreate error:

    a) Placed file animatescript.dsa into script folder

    b) highlighted Shirt item, double click on the animatescript.dsa file

    c) Tried Merge animatescript.dsa file as well

     

    var item = scene.getprimaryselection();

    if ( item ) {

    var vis = item.findPropertyBylabel( "Visible" );

    if ( vis ) { vis.setCanAnimate( true );

    }

    }

     

    2019-10-06 00:05:23.969 Loading script: C:/Users//Documents/animatescript.dsa

    2019-10-06 00:05:23.969 WARNING: Script Error: Line 1

    2019-10-06 00:05:23.969 WARNING: ReferenceError: Can't find variable: scene

    2019-10-06 00:05:23.969 WARNING: Stack Trace:

    <anonymous>()@C:/Users//Documents/animatescript.dsa:1

    2019-10-06 00:05:23.970 Error in script execution: C:/Users//Documents/animatescript.dsa

  • Scene is capitalised - but you can copy and paste the script, it's fancy formatting for code, not an image.

  • macleanmaclean Posts: 2,438

    Yes, you can just drag in the code window to highlight everything, the copy/paste it into a text file and save with the .dsa extension.

    I'm actually slightly astonished that I was on the right track, although we'll see if it works or not.

    Thanks for pointing out the 'scene/Scene' thing, Richard. I'd never have noticed that.

  • RurisRuris Posts: 123

    Hi,

    Same step as previous:

    a) Highlight object in scene

    b) Double click on script

    Slightly different message than earlier though.

    2019-10-07 12:05:38.985 Loading script: E:/Daz3d Stuff/DAZ3D Runtime for Everything/Scripts/Extras/animatescript.dsa

    2019-10-07 12:05:38.987 WARNING: Script Error: Line 1

    2019-10-07 12:05:38.987 WARNING: SyntaxError: Parse error

    2019-10-07 12:05:38.987 WARNING: Stack Trace:

    <anonymous>()@E:/Daz3d Stuff/DAZ3D Runtime for Everything/Scripts/Extras/animatescript.dsa:1

    2019-10-07 12:05:38.991 Error in script execution: E:/Daz3d Stuff/DAZ3D Runtime for Everything/Scripts/Extras/animatescript.dsa

    dsa
    dsa
    animatescript.dsa
    162B
  • macleanmaclean Posts: 2,438

    Weird. I downloaded your script and compared it with mine. As far as I can see, they're identical, except for 2 things. 1. It gives an error. 2. Your file is 162kb and my original is 157kb.

    So I copied/pasted mine into yours and resaved it (159kb) and got no error.

    Then I opened yours in Script IDE and saw this on Line 1

    ​var item = Scene.getPrimarySelection();

    That 1st char '​' should NOT be there. Where it came from, I don't know, but that's the problem. If I delete it in the IDE window, the script works fine.

  • RurisRuris Posts: 123

    I downloaded Notepad++, repaste and check the extra characters.....seems normal? Earlier attempt was using default notepad. Screenshot attached.

    script error.png
    1676 x 802 - 140K
  • Actually, Visible in Render is animatable (which I didn't realise) - so that should be usable, if you just want to hide for rendering

  • RurisRuris Posts: 123

    Yeah, when testing the whole set of options under Display, Visible in render was somehow working and captured in keyframe. Well, my scenario was how to make an dforce object 'float' in the sky held by a 2d plane, so I need a proper 'scene invisible'.

    Anyway, i just used a workaround, that is to slide the 2d plane and let it drop organically. Thanks for trying to help me out, appreciate it.

  • Ruris said:

    Yeah, when testing the whole set of options under Display, Visible in render was somehow working and captured in keyframe. Well, my scenario was how to make an dforce object 'float' in the sky held by a 2d plane, so I need a proper 'scene invisible'.

    Anyway, i just used a workaround, that is to slide the 2d plane and let it drop organically. Thanks for trying to help me out, appreciate it.

    If you want to avoid any possible drag effect it might be better to have the plane go below ground level in a single frame, leaving the dForce item free to fall (if I understand the situation correctly). If you did that you'd want to use the new features of the DS 4.12 Timeline to make sure it stayed still before the drop frame.

  • cdeubcdeub Posts: 0
    maclean said:

    Found it!! I had to hunt through my files for this script without knowing its name. I'm not even sure it's the answer, but it might be worth a try.

    I had a similar issue last year when I was doing some ERC and couldn't get Visibility to work as a linked property. Richard Haseltine came up with the answer, which was that Visibilty isn't animatable by default. You have to apply this script first, then it can be linked and will work.

    Caveat - This worked in my situation, but I make no guarantees.

    var item = Scene.getPrimarySelection();if ( item ) {	var vis = item.findPropertyByLabel( "Visible" );	if ( vis ) {		vis.setCanAnimate( true );	}}

    Save that as a .dsa then put it in content and apply it like a normal preset. Once Visibilty is animatable, you should be able to set it in the timeline.

    All credit to Richard Haseltine for this script. I hope it actually helps.

    Thanks a lot for providing this script. It has helped me immensely with the realization of my animation. And I learned a lot about Daz3d scripting. Make fun :)

Sign In or Register to comment.