My graph is crashing!

Post Reply
izo
Posts: 55
Joined: Wed Sep 19, 2012 2:42 pm

My graph is crashing!

Post by izo » Mon Jul 08, 2013 2:10 pm

I'm quite new to scripting and graphs, but I'm trying to set up a graph that gets the transformation and rotation of a camera, creates a null and sets the position and rotation based on the camera.

I created a graph that does this, but with a cube instead of a camera, but as soon as I switch to trying to use a camera, RF will crash as soon as I evaluate.
Does anyone have an idea why? Or should I do it another way?

Here's the graph as is now:
https://www.dropbox.com/s/rpjjbpd7zgvh767/graph01.png

XML:
<?xml version="1.0" encoding="utf-8"?>
<scene>
<nodes>
<node>
<name>GetCamera_01</name>
<type>GetCamera</type>
<inputs>
<input>
<name>name</name>
<type>string</type>
<value>SceneCamera01</value>
</input>
</inputs>
</node>
<node>
<name>GetTransformation_01</name>
<type>GetTransformation</type>
<inputs/>
</node>
<node>
<name>SceneAddObject_01</name>
<type>SceneAddObject</type>
<inputs>
<input>
<name>type</name>
<type>list</type>
<value>null</value>
</input>
</inputs>
</node>
<node>
<name>SetTransformationFromComponents_01</name>
<type>SetTransformationFromComponents</type>
<inputs>
<input>
<name>scale</name>
<type>vector3</type>
<value>0.000000,0.000000,0.000000</value>
</input>
</inputs>
</node>
<node>
<name>Evaluator_01</name>
<type>Evaluator</type>
<inputs>
<input>
<name>evaluate</name>
</input>
</inputs>
<outputs/>
</node>
</nodes>
<connections>
<connection>
<source>root.GetCamera_01.node</source>
<target>root.GetTransformation_01.node</target>
</connection>
<connection>
<source>root.SceneAddObject_01.object</source>
<target>root.SetTransformationFromComponents_01.node</target>
</connection>
<connection>
<source>root.GetTransformation_01.position</source>
<target>root.SetTransformationFromComponents_01.translation</target>
</connection>
<connection>
<source>root.GetTransformation_01.rotation</source>
<target>root.SetTransformationFromComponents_01.rotation</target>
</connection>
<connection>
<source>root.SetTransformationFromComponents_01.evaluate</source>
<target>root.Evaluator_01.evaluate</target>
</connection>
</connections>
<layout>
<nodes>
<node>
<name>root.GetCamera_01</name>
<position>25.000000,71.000000</position>
<color>0.572000,0.654647,0.880000</color>
<collapsed>false</collapsed>
<horizontal_inputs>true</horizontal_inputs>
<horizontal_outputs>true</horizontal_outputs>
</node>
<node>
<name>root.GetTransformation_01</name>
<position>195.000000,125.000000</position>
<color>0.572000,0.654647,0.880000</color>
<collapsed>false</collapsed>
<horizontal_inputs>true</horizontal_inputs>
<horizontal_outputs>true</horizontal_outputs>
</node>
<node>
<name>root.SceneAddObject_01</name>
<position>198.001453,47.571778</position>
<color>0.838808,0.880000,0.572000</color>
<collapsed>false</collapsed>
<horizontal_inputs>true</horizontal_inputs>
<horizontal_outputs>true</horizontal_outputs>
</node>
<node>
<name>root.SetTransformationFromComponents_01</name>
<position>437.512582,140.143886</position>
<color>0.572000,0.654647,0.880000</color>
<collapsed>false</collapsed>
<horizontal_inputs>true</horizontal_inputs>
<horizontal_outputs>true</horizontal_outputs>
</node>
<node>
<name>root.Evaluator_01</name>
<position>712.115550,199.921071</position>
<color>0.572000,0.828667,0.880000</color>
<collapsed>false</collapsed>
<horizontal_inputs>true</horizontal_inputs>
<horizontal_outputs>true</horizontal_outputs>
</node>
</nodes>
<notes/>
</layout>
</scene>


Any help appreciated.
/Dave

User avatar
Alex
Site Admin
Posts: 143
Joined: Mon Jun 14, 2010 9:35 am

Re: My graph is crashing!

Post by Alex » Mon Jul 08, 2013 3:21 pm

Hi Dave,

you are right, it crashes. :(

The problem is that the GetTransformation node is trying internally to access the pivot parameter of the Camera, which does not happen to exist.

You can use the following code. It needs an extra node, but it could work until we fix the problem.

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<scene>
    <nodes>
        <node>
            <name>GetCamera_01</name>
            <type>GetCamera</type>
            <inputs>
                <input>
                    <name>name</name>
                    <type>string</type>
                    <value>SceneCamera01</value>
                </input>
            </inputs>
        </node>
        <node>
            <name>SceneAddObject_01</name>
            <type>SceneAddObject</type>
            <inputs>
                <input>
                    <name>type</name>
                    <type>list</type>
                    <value>cube</value>
                </input>
            </inputs>
        </node>
        <node>
            <name>SetTransformationFromComponents_01</name>
            <type>SetTransformationFromComponents</type>
            <inputs>
                <input>
                    <name>scale</name>
                    <type>vector3</type>
                    <value>1.000000,1.000000,1.000000</value>
                </input>
            </inputs>
        </node>
        <node>
            <name>Evaluator_01</name>
            <type>Evaluator</type>
            <inputs>
                <input>
                    <name>evaluate</name>
                </input>
            </inputs>
            <outputs/>
        </node>
        <node>
            <name>GetNodeParameter_01</name>
            <type>GetNodeParameter</type>
            <inputs>
                <input>
                    <name>parameter</name>
                    <type>string</type>
                    <value>Position</value>
                </input>
            </inputs>
        </node>
        <node>
            <name>GetNodeParameter_02</name>
            <type>GetNodeParameter</type>
            <inputs>
                <input>
                    <name>parameter</name>
                    <type>string</type>
                    <value>Rotation</value>
                </input>
            </inputs>
        </node>
    </nodes>
    <connections>
        <connection>
            <source>root.SceneAddObject_01.object</source>
            <target>root.SetTransformationFromComponents_01.node</target>
        </connection>
        <connection>
            <source>root.SetTransformationFromComponents_01.evaluate</source>
            <target>root.Evaluator_01.evaluate</target>
        </connection>
        <connection>
            <source>root.GetCamera_01.node</source>
            <target>root.GetNodeParameter_01.node</target>
        </connection>
        <connection>
            <source>root.GetCamera_01.node</source>
            <target>root.GetNodeParameter_02.node</target>
        </connection>
        <connection>
            <source>root.GetNodeParameter_02.number</source>
            <target>root.SetTransformationFromComponents_01.rotation</target>
        </connection>
        <connection>
            <source>root.GetNodeParameter_01.number</source>
            <target>root.SetTransformationFromComponents_01.translation</target>
        </connection>
    </connections>
    <layout>
        <nodes>
            <node>
                <name>root.GetCamera_01</name>
                <position>-99.000000,298.000000</position>
                <color>0.572000,0.654647,0.880000</color>
                <collapsed>false</collapsed>
                <horizontal_inputs>true</horizontal_inputs>
                <horizontal_outputs>true</horizontal_outputs>
            </node>
            <node>
                <name>root.SceneAddObject_01</name>
                <position>9.000000,104.000000</position>
                <color>0.838808,0.880000,0.572000</color>
                <collapsed>false</collapsed>
                <horizontal_inputs>true</horizontal_inputs>
                <horizontal_outputs>true</horizontal_outputs>
            </node>
            <node>
                <name>root.SetTransformationFromComponents_01</name>
                <position>306.000000,247.000000</position>
                <color>0.572000,0.654647,0.880000</color>
                <collapsed>false</collapsed>
                <horizontal_inputs>true</horizontal_inputs>
                <horizontal_outputs>true</horizontal_outputs>
            </node>
            <node>
                <name>root.Evaluator_01</name>
                <position>524.000000,247.000000</position>
                <color>0.572000,0.828667,0.880000</color>
                <collapsed>false</collapsed>
                <horizontal_inputs>true</horizontal_inputs>
                <horizontal_outputs>true</horizontal_outputs>
            </node>
            <node>
                <name>root.GetNodeParameter_01</name>
                <position>84.000000,330.000000</position>
                <color>0.572000,0.654647,0.880000</color>
                <collapsed>true</collapsed>
                <horizontal_inputs>true</horizontal_inputs>
                <horizontal_outputs>true</horizontal_outputs>
            </node>
            <node>
                <name>root.GetNodeParameter_02</name>
                <position>87.000000,470.000000</position>
                <color>0.572000,0.654647,0.880000</color>
                <collapsed>true</collapsed>
                <horizontal_inputs>true</horizontal_inputs>
                <horizontal_outputs>true</horizontal_outputs>
            </node>
        </nodes>
        <notes/>
    </layout>
</scene>

Thanks for finding it.
Alex Ribao
RealFlow Team
Next Limit Technologies

izo
Posts: 55
Joined: Wed Sep 19, 2012 2:42 pm

Re: My graph is crashing!

Post by izo » Mon Jul 08, 2013 3:29 pm

Thanks Alex, you made my day!

Works like a charm now.

izo
Posts: 55
Joined: Wed Sep 19, 2012 2:42 pm

Re: My graph is crashing!

Post by izo » Wed Jul 10, 2013 2:50 pm

By the way...

Maybe you guys should have a separate subforum for simulation graphs?

User avatar
gus
Site Admin
Posts: 276
Joined: Thu May 27, 2010 2:31 pm

Re: My graph is crashing!

Post by gus » Wed Jul 10, 2013 2:59 pm

izo wrote:By the way...

Maybe you guys should have a separate subforum for simulation graphs?
Good point. Will be there shortly.
Thanks for reminding us.

[EDIT : http://www.realflow.com/forum/viewforum.php?f=88 ]

g-)
...........Gus Sánchez-Pérez..........
RealFlow Product Manager
Next Limit Technologies

Post Reply