data objects..

About Truespace Archives

These pages are a copy of the official truespace forums prior to their removal somewhere around 2011.

They are retained here for archive purposes only.

data objects.. // Scriptorium

1  |  

Post by stan // Oct 4, 2006, 5:45pm

stan
Total Posts: 1240
pic
first sorry for getting off topic in other thread Norm..

what I'm really trying to understand is data objects and how they are used..it seems you need to have a corresponding attribute from the attach to attributes lists or add attributes....are all of them listed there for all of the data objects, from E:\devguide\DataObjects\main.html..:confused:

I've been trying with RenderAttributes..managed to compile with no error..

RenderAttributes = params.conValue('RenderAttributes');
params.conValue('get points') = RenderAttributes.SetPointSize ( true, 'get points' );

it doesn't do anything at this point other than give no errors..:D

Post by Norm // Oct 4, 2006, 6:21pm

Norm
Total Posts: 862
pic
Well lets put a purpose on your quest Stan.


No probs about the other thread. I removed my post, but will put the important point here: if this forum and us users do something of value and interest here, I can guarantee the developers will take an interest. They have access to read and post here.


By "purpose" I mean give me a situation that you are trying to create and an example of the code you have so far: script object loaded as attachment or such.


Regarding data objects, sometimes I have to get a handle on how other data objects are called upon in other scripts. If we run across a data object that is not fully defined, we could present this to the developers and ask for thier advice and wisdom.


params.conValue refers to a connector that you created on the Attributes tab, so this only masks the scenario. Let me have a look through some scripts and continue in next post.

Post by Norm // Oct 4, 2006, 8:17pm

Norm
Total Posts: 862
pic
Ok here is as far as I have taken so far.

The attached image shows the limited script.


First thing I always do is create simple script. I put three attributes for output but rename them on the exterior interface to make sense. So outA, outB and outC are my output connectors.


Once I move into the Methods tab of the Script Editor, I begin by identifying things so I do not need connectors. I wish to talk directly to the Object Render Attributes "node" within the Cube,1 object. It is only cube that has them in the attached scene.


So owner variable is defined as System.ThisOwner(). Type this line in your own object, in fact recreate this object yourself so you get the feel of the autocomplete, which is really best friend. As you type the "." between System and ThisOwner, the autocomplete kicks in and you know you are on the right track. This little tip is very important as this script and indeed others progress.


Once owner is defined, I build on it. Remember we have a "controlled" environment here with two cubes and their names are easily seen in the Link Editor. My code then creates some additional variables to "locate" both cubes.


daCube0

daCube1


Once they are located, I can begin to test if "Object Render Attributes "node" exists. I do this by creating two more variables, where I build again on what I have done so far.


daCube0RA

daCube1RA


Notice how I concantinate the variables using a "+" sign and in single quotes, I use a /nameOfNodeHere type scenario. I then use a couple of "if" statements to test whether we have such a node. Node.Exists returns a true or false to the question. I added a System.Alert() as I was building the script object. Before I was moving any further in script, I had to have a positive return for Cube,1 having the Object Render Attributes node. I get a positive result in form of a system alert that you have to click on ok to get rid of. I am on right track and all is well.


Next, with a positive result for the node, I can then call that node. It is important to note, that if I "assume" a node exists, I wll get an error if it does not. So if you edit the code to call Cube's Object Render Attributes node, your script errors out cause it is not there. So test for existence is safe code practice, unless you are for sure in a controlled env, where you do not assume, rather know the node exists. So although redundant, I show in script to help you with future error scenarios:p heh


Anyways, the next important line of code:


RAdaCube1 = Node.Value(daCube1RA, 'RenderAttributes');


Here I assign a variable to hold all the combined exported values in the Object Render Attributes' RenderAttributes output connector. I have an array of all the data in that connector.


The code exits the "if" at this point and I populate the output connectors with values from that RenderAttributes array data. This is again where the autocomplete is helpful in telling you whether you are on the right track or not. As I type in the lines of code and get to the dot between RAdaCube1 and GetFaceOpacity, the autocomplete shows up, telling me that I have called the connector properly.


The next step, which I figure we may wish to try, would be to contact same Object Render Attributes, but set values for the Object Render Attributes input connectors.


The code I provided is a bit loose in some respects. Do not consider it perfect code but rather showing some different ways to do things. The only object of the code was to contact RenderAttributes connector as Stan requested. The code does this and a little more. The population of the output nodes should actually be set inside the if statements. Is bad practice to populate outside in such a case. What if yo use set object render attributes for cube object. The script fails to provide what you want. Is only set up to work on cube,1 object. It could be set up to test and set connectors properly for either cube object. The values on interface could show cube's values first, then you would get second System.Alert and the values on interface would then change to reflect the values found for cube,1. You get to tinker with it a bit is how I feel. But the info is there Stan. Let me know if any questions arise regarding what I did here.

Post by stan // Oct 5, 2006, 11:07am

stan
Total Posts: 1240
pic
thanks Norm..that gives me a working model..:D I know for myself it's the best way to learn..this will keep me busy ..:)

Post by Norm // Oct 5, 2006, 12:08pm

Norm
Total Posts: 862
pic
Well the idea is to use the forum to collaborate and learn so hopefully you will discuss what you are doing here in this thread Stan.

Never know if it will come in handy.

I have been trying to get back to this all day with no success. Just one of them days :)


I was playing with object render attributes today in shared space. Perhaps I will drop a little scenario in ss tonite during meeting to demo. It worked will in a meeting we had. It was/is a wired scenario though. :o

Post by Norm // Oct 13, 2006, 8:42am

Norm
Total Posts: 862
pic
Did you have success in this scenario Stan?

Post by stan // Oct 13, 2006, 2:56pm

stan
Total Posts: 1240
pic
thanks for asking Norm, not completely..partly due to being side tracked with toolbars in title bars :rolleyes: but have learned how to attach them to an object..
I still wanted to try and make per object render presets icons this way..shouldn't be too hard

Post by stan // Oct 21, 2006, 4:33pm

stan
Total Posts: 1240
pic
I haven't been able to figure out why my 'IN' options only change the values in the 'OUT' boxes..they don't change the object's realtime render ststus nothing happens..


what I have learned is where data objects belong :D
when adding a new attribute, some have the word Data at the end of the type name in it's 'type'. most with 'Data' at the end of the type name have data objects connected to them...
in the lower image is a list of many types that have data objects attached to them..
then when you type the '.' after [in this sample RAselected ] a popup appears with the associated data objects..

Post by trueBlue // Nov 5, 2006, 10:05pm

trueBlue
Total Posts: 1761
pic
Here is all the paths for all Layouts for the tS7 main window and in this case the BackgroundColor.
HTH

Post by Norm // Nov 6, 2006, 9:48am

Norm
Total Posts: 862
pic
I would say the array type is not functioning properly in ts7.11

In ts7.5, we have some new types in the array area. They work ok but are not compatible with ts7.11.
Awportals.com is a privately held community resource website dedicated to Active Worlds.
Copyright (c) Mark Randall 2006 - 2024. All Rights Reserved.
Awportals.com   ·   ProLibraries Live   ·   Twitter   ·   LinkedIn