Limitation in creating new node in Inventor

Limitation in creating new node in Inventor

Post by Michelle Zh » Thu, 23 Dec 1993 03:25:27



Hello,
        I am using Inventor extendability to create new nodes for
my application. However, I have 3 questions about the limitation in
creating the new node....

1. Since in new node, when you initialize the field data, you always
   have to give a default value. Is there anyway without specifying the
   default value? Esp. such as SoSFName field, I want it to be NULL pointer
   instead of "NULL" string... I tried but don't know how...

2. If it is possible to create a node which inherited from more than parent
   class? For example, I create parent1 class and parent2 class, I want to
   my childClass inherited both from parent1 and parent2.(Multiple inheritance)
   How can I initialize the SO_SUBNODE_INIT_ID(childClass, "childClass", ?)
   I mean which one I should put it in "?" position? Or what I should do this?
  (I didn't use SoCustomNode)

3. If I already have set up a default value for a field data when I create this
   node class, can its subclass override the default value? For example. I create
   the new node PeopleNode, which has default sex MALE, (see {MALE ,FEMALE} are
   enumerated type. I create a SonNode class which default sex sould me MALE,
   how can I override the default setting in PeopleNode? (since everything is
   herited from parent class) Should I override in my constructor withing
   PROTOTYPE scope or somewhere else?

Thanks for your help in advance!

Michelle

 
 
 

Limitation in creating new node in Inventor

Post by Bob H Squir » Thu, 23 Dec 1993 05:46:44



>Hello,
>    I am using Inventor extendability to create new nodes for
>my application. However, I have 3 questions about the limitation in
>creating the new node....
>1. Since in new node, when you initialize the field data, you always
>   have to give a default value. Is there anyway without specifying the
>   default value? Esp. such as SoSFName field, I want it to be NULL pointer
>   instead of "NULL" string... I tried but don't know how...

You won't be able to do this.  It's like setting a float equal to a string.

Quote:>2. If it is possible to create a node which inherited from more than parent
>   class? For example, I create parent1 class and parent2 class, I want to
>   my childClass inherited both from parent1 and parent2.(Multiple inheritance)
>   How can I initialize the SO_SUBNODE_INIT_ID(childClass, "childClass", ?)
>   I mean which one I should put it in "?" position? Or what I should do this?
>  (I didn't use SoCustomNode)

I tried deriving a SoCustomNode from another SoCustomNode, and had no
luck.  Some of the macros for doing this in SoCustomNode.h are not right.
I suspect you'll have the same trouble.



 
 
 

Limitation in creating new node in Inventor

Post by Gavin Be » Fri, 24 Dec 1993 01:49:56




>1. Since in new node, when you initialize the field data, you always
>   have to give a default value. Is there anyway without specifying the
>   default value? Esp. such as SoSFName field, I want it to be NULL pointer
>   instead of "NULL" string... I tried but don't know how...

The default value can be any valid value of the underlying data type;
for an SoSFName, it can be any SbName.  An SbName cannot have a value
of NULL, so no, there is no way of having the default value be NULL.
(the empty string, "", is a reasonable default; is there a reason you
don't want to use it?).

Beware of SoSFNames, by the way-- SbNames are designed to be used for
'global' names that are likely to hang around, and are never deleted.
If your SoSFName field is likely to change, make it an SoSFString
instead.

Quote:>2. If it is possible to create a node which inherited from more than parent
>  class? For example, I create parent1 class and parent2 class, I want to
>  my childClass inherited both from parent1 and parent2.(Multiple inheritance)

Multiple inheritance within the node hierarchy is impossible.  The
run-time type system (SoType) doesn't allow for it, for one thing.
And I wouldn't be suprised if there are other places inside Inventor
that will break for multiply-inherited nodes (e.g. a node that is
inherited from two different kinds of SoGroups will have two different
sets of children, which will probably confuse any SoPaths that go
through that node).

Quote:>3.If I already have set up a default value for a field data when I
>create this node class, can its subclass override the default value?
>For example. I create the new node PeopleNode, which has default sex
>MALE, (see {MALE ,FEMALE} are enumerated type. I create a SonNode
>class which default sex sould me MALE, how can I override the default
>setting in PeopleNode? (since everything is herited from parent class)
>Should I override in my constructor withing PROTOTYPE scope or
>somewhere else?

In Inventor 1, child classes must register all of their fields, even
fields in parent classes.  So you will have to have two ADD_FIELD macros
for the sex field (one in the base class that sets its default to MALE
and one in the derived class that sets its default to FEMALE).

We fixed that in Inventor 2; to override the base classe's default
value you'll set the field's value and then set the field's
isDefault flag (using an internal method that is hidden inside the
ADD_FIELD macro) (we got rid of the notion of a special
'firstInstance' in Inventor 2, which made some things cleaner).

--

 
 
 

1. Creating new property nodes in Inventor

I'm am deriving a new property node class from SoTexture2
and am having difficulty when a writeAction is applied to this
node.  When the node is written out, the fields that I have
added to my derived class are written out correctly, however
the SoTexture2 nodes (such as filename) are not written out at all.
There doesn't seem to be an example of this situation in any of the
manuals.  Do I have to explicitly re-add these fields to my
derived class at prototype creation time, or is there some other
statements I need to include to make this work?

--
Paul Harding                            Alias Research Inc.
Technical Director                      110 Richmond St. E.
                                        Toronto, Ont. Canada, M5C 1P1
                                        (416) 362-9181 Fax (416) 861-8802

2. island model needed

3. Creating my own nodes in Inventor 1.1

4. Free demo version of 3D clothing animation software

5. Those new nodes in Inventor 2.2

6. two video cards simultaneusly?

7. new nodes and elements in Open Inventor

8. Very Basic question on FillRect

9. Creation of new Inventor Nodes

10. new inventor node( getting bounding box )!!!

11. Please help: problem in deriving new inventor node

12. Create a new SoGroup Node...

13. creating a new Node for Information tasks