PDA

View Full Version : Custom Box shape and saving panel values



clintonman
03-02-2014, 11:36 PM
120553

I created a Custom Object in the form of a box that is useful for lining up a camera in Layout. It has the same basic inputs as the geometry box tool and you can set the color and hide any of the 6 faces.

Is there a way to save the dialog box settings for a Custom Object within the scene file?

The script can be found about 1/3 the way down this page:

http://www.clintons3d.com/plugins/lightwave/index.html

stevecullum
04-20-2014, 07:10 AM
Could you append the current dialogue box information values to the LWS scene file, but adding them as the equivalent of comments, so they are ignored by LW. Then when the plugin is invoked, read them back?

clintonman
04-20-2014, 05:26 PM
Could you append the current dialogue box information values to the LWS scene file, but adding them as the equivalent of comments, so they are ignored by LW. Then when the plugin is invoked, read them back?
That was a good idea, but I don't see any way to read the comments via script.

stevecullum
04-21-2014, 01:59 AM
LWS files are ASCII I think, is I thought you might be able to use some standard python IO functions to read it in. Something like:
print("\nReading characters from the file.")
text_file = open("scene.lws", "r")
print(text_file.read(1))
print(text_file.read(5))
text_file.close()

Haven't tried it myself, but I understood the regular python library could read plain text files in ASCII format.

clintonman
04-21-2014, 08:41 AM
It's not so much reading from the file, but how to write to the file. That's where I'm really stuck.

jeric_synergy
04-21-2014, 10:50 AM
There're some entities in LW files (LWO, sadly) that apparently aren't used much: perhaps there're equivalents in the LWS file.

Here's an ugly hack: store the info in a null object path.

I've also used plugins that generated crazy numbers of keyframes in xchannels, perhaps that's an option here.

ernpchan
04-21-2014, 01:41 PM
It's not so much reading from the file, but how to write to the file. That's where I'm really stuck.

What about writing/reading the data to an external text file?

jeric_synergy
04-21-2014, 03:24 PM
Personally, I h8 having to having to keep track of multiple files. LWOs are bad enough.

FReq: some mechanism should exist for plugin developers to embedded arbitrary data within LWS files (and for all I know, already does). This seems obvious.

It really seems this must already exist in SOME form.

stevecullum
04-21-2014, 04:14 PM
It's not so much reading from the file, but how to write to the file. That's where I'm really stuck.

A challenge for sure. I quite like the suggestion of storing values in null object vectors. Was something I was thinking about as an option too. Probably easier than reading in the lws file and trying to append data etc...

oliverhotz
04-21-2014, 09:11 PM
It really seems this must already exist in SOME form.

it does exist.. check here: http://justaddmilk.org/?p=686 for a sample on how.

clintonman
04-21-2014, 10:12 PM
it does exist.. check here: http://justaddmilk.org/?p=686 for a sample on how.
Thank you. That looks perfect.:thumbsup: I was looking around in the SDK and either finding nothing or a somewhere around 200 places to look. I search "save" in the python docs and it's the first thing to come up.:twak:

clintonman
04-21-2014, 11:32 PM
It worked. I can save settings to the scene file now. It's like they say, "It's easy when you know how". :) :rolleyes:
The only alteration is I compared the loaded result to the number of values instead of 0. That way it sees the case when the scene file ends prematurely(result == -1).

stevecullum
04-22-2014, 12:49 AM
Glad you found an easy way to embed the extra data. Justaddmilk.org is turning out to be a great resource!