Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Force reload a new blueprint and save it to a file
#1
Gran sonrisa 
Dear Jose,

Thank you very much for your last quick response, and for your kind disposition to help us.
I'm sorry to bother you again, but we really need your help. Ángel

It seems that we are not doing well in reassigning the new Blueprint to the "Obi SkinnedCloth" component, because after the process the dress behaves as if it were completely flexible (and ends up falling off completely). However, the original blueprint had a rigid zone (with skin radius = 0) and another flexible zone.

[Image: blueprint_obi2.jpg]

Therefore, we wanted to ask you for help with the following questions:

- How could we save the new Blueprint (with the updated properties and groups) in a different file, so that we could open it later? Currently we are only creating it as a memory object.

- What is the right way to reassign the new Blueprint to the "Obi SkinnedCloth" component, and force it to reload?
(As we didn't find the "set" option for the "blueprint" property of the "Obi SkinnedCloth" class, we changed the "m_SkinnedClothBlueprint" property from protected to public, and re-assigned it to the new generated blueprint).

- Currently we have initially deactivated the components "Obi SkinnedCloth" and "Obi SkinnedCloth Renderer", and, in addition, the component "Obi SkinnedCloth" already has in the editor defined the reference to an existing blueprint, which we update with the new values, and after that we activate both components. But it seems that this is not working...
Is there a correct way to pause the Solver, or do we just have to deactivate these components while updating the blueprint, and then reactivate them, in order to force the reading of the new blueprint?

Thank you in advance, for your patience and for your help! Gran sonrisa

PD: De antemano, le agradeceremos poder recibir su ayuda, pues esto es lo último que nos falta para terminar.  Huh
Reply
#2
(24-08-2020, 06:04 AM)nexar Wrote: - How could we save the new Blueprint (with the updated properties and groups) in a different file, so that we could open it later? Currently we are only creating it as a memory object.

Blueprints are just ScriptableObjects, as such, they are saved and managed the same way as you do with any asset in Unity. This is not specific to Obi.

You need to call AsseDatabase.CreateAsset:
https://docs.unity3d.com/ScriptReference...Asset.html

followed by a call to AssetDatabase.SaveAssets:
https://docs.unity3d.com/ScriptReference...ssets.html

(24-08-2020, 06:04 AM)nexar Wrote: - What is the right way to reassign the new Blueprint to the "Obi SkinnedCloth" component, and force it to reload?
(As we didn't find the "set" option for the "blueprint" property of the "Obi SkinnedCloth" class, we changed the "m_SkinnedClothBlueprint" property from protected to public, and re-assigned it to the new generated blueprint).

Just assign the new blueprint to cloth.skinnedClothBlueprint property. Each ObiActor subclass has its own read/write blueprint property (skinnedClothBlueprint, tearableClothBlueprint , clothBlueprint). The generic "blueprint" property is just an accessor, its return type is the base class for the actor's blueprint, and intended to get access to the blueprint w/polymorphism: when you just have a reference to a ObiActor but you don't know what's the actual type of the instance. See the API docs for details.

Making the backing variable public and changing it directly won't have any effect at all, all you're doing is setting a variable but skipping all the code that actually loads the blueprint. This takes place in the skinnedClothBlueprint's property setter.

(24-08-2020, 06:04 AM)nexar Wrote: - Currently we have initially deactivated the components "Obi SkinnedCloth" and "Obi SkinnedCloth Renderer", and, in addition, the component "Obi SkinnedCloth" already has in the editor defined the reference to an existing blueprint, which we update with the new values, and after that we activate both components. But it seems that this is not working...
Is there a correct way to pause the Solver, or do we just have to deactivate these components while updating the blueprint, and then reactivate them, in order to force the reading of the new blueprint?

There's no need to do any of that. Simply assigning the new blueprint should be enough, the property setter takes care of all this.
Reply
#3
Hi José,

Thank you very much for your patient help. It has been very helpful, as we have followed your suggestions and been able to solve almost everything.

Although we were able to save a new generated blueprint, we are having problems editing the file. We have described this in detail in the question n°2 of the following thread:

http://obi.virtualmethodstudio.com/forum/thread-2462.html

Thank you very much for your help!


Gran sonrisa
Reply