Page 1 of 1
Save an object's properties to a text file
Posted: Wed Jun 18, 2008 6:59 pm
by mokogobo
Hello.
I'm working on a project in Revolution and need to generate a number of "image" objects based on a common template image object. I've set up an image object just how I want the template image object to be, and am curious if I can save the settings of the object to a text file and later reload them to create more image objects.
An alternative method would be to set up my image object and then make it invisible, and copy it, but I'd prefer to generate the objects completely dynamically from settings stored in a file. I'm not able to find any good documentation on the entire list of properties available to Revolution objects, so I'd just like to save the existing properties to a file, and reload them later. Any ideas?
Posted: Wed Jun 18, 2008 7:47 pm
by Mark
Dear mokogobo,
I export all properties of all objects and cards of a stack to an XML file, for DIFfersifier (which is at
http://economy-x-talk.com/differsifier.html ). It is quite simple to do this, using the propertynames function and a repeat loop.
I wouldn't do this, however, only to replicate an object inside Revolution. If this is all you want, it is so much easier to save a custom template object in your project and copy it to wherever you need it. A simple copy command is much easier and probably much faster than reading all properties from a file and setting the properties of an object using a repeat loop.
Best,
Mark
Posted: Wed Jun 18, 2008 8:25 pm
by mokogobo
Mark wrote:If this is all you want, it is so much easier to save a custom template object in your project and copy it to wherever you need it. A simple copy command is much easier and probably much faster than reading all properties from a file and setting the properties of an object using a repeat loop.
Do you mean to create the object, make it invisible or store it to a "template card" and just copy it, or is there a better way?
Posted: Wed Jun 18, 2008 8:26 pm
by Mark
Dear mokogobo,
Yes, that's what I mean.
Best,
Mark
Posted: Wed Jun 18, 2008 8:35 pm
by mokogobo
Mark wrote:Dear mokogobo,
Yes, that's what I mean.
Best,
Mark
Okay. That's what I originally did, but it felt a bit too "hacky". I found that the "templateImage" can be configured to set the default properties for new images created. This seems like a nice way to go about it...
I'm thinking:
1) Initially load properties from an XML file and close file
2) Use the loaded properties to set the templateImage
3) Create any images needed
4) Reset the template image
Anyway, thanks for your direction.
Posted: Wed Jun 18, 2008 8:49 pm
by Mark
Hi mokogobo,
You should just save the object in your project and copy it when you need it. That's the best way to do it.
Best regards,
Mark
Posted: Wed Jun 18, 2008 10:11 pm
by mokogobo
Mark wrote:Hi mokogobo,
You should just save the object in your project and copy it when you need it. That's the best way to do it.
Best regards,
Mark
Alright. Is the best way to save it to a new card on the same stack, or a new stack? I'm having some trouble copying the image from another card on the same stack... it closes the current card or makes it invisible. While I could switch back to the desired card, I'd prefer the copying took place in the background. Any pointers?
Posted: Wed Jun 18, 2008 10:54 pm
by Mark
Dear mokogobo,
It doesn't matter where you keep the object, as long as it is part of your project. You need to refer to the object as part of a stack, if it isn't part of the current stack: copy img x of cd y of stack z to this cd.
The stack with the object needs to be in memory. I am not sure, right now, whether the card with the object has to be on screen. If is has to be, you can still set the right of the stack to -100, to make it invisible, or perhaps set the invisible of the stack to true. Just experiment a but and see what works best for you.
Best regards,
Mark
Posted: Wed Jun 18, 2008 11:34 pm
by mokogobo
Thanks. I really appreciate your help.
