connections(连接件)——Object和Property的桥梁

本文介绍了Fbx SDK中的连接件(Connection)如何连接对象(Object)和特性(Property)。连接件用于处理FbxObject与FbxProperty之间的关系,通过特定函数进行操作。此外,文章还探讨了特性与属性的区别,以及对象-特性、对象-对象和特性-特性之间的连接方式。最后,通过实例展示了FbxNode与FbxNodeAttribute之间的关系以及如何使用连接件创建父子节点和设置节点属性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一个连接件就是Fbx sdk中用来处理对象(Object)和特性(Property)之间关系的数据结构。连接件数据结构不开源,但可以通过以下函数来操作: FbxObject::ConnectSrcObject(),FbxObject::ConnectDstObject()FbxProperty::ConnectDstObject(),FbxProperty::ConnectSrcProperty()

     这里我们来讨论一下特性(Property)和属性(Attribute)的区别:特性是一个类中特有的;属性可以是一个类特有的,也可以是几个类都有的。在程序中,特性就是类中的属性(比如节点类FbxNode和它内部的转换向量),属性就是一个独立的类(比如FbxNodeAttribute)。

     连接件可以视为目的层(destination)和资源层(source),以下是各种连接关系的操作函数:

     对象-特性 连接:FbxObject::GetSrcProperty() ,FbxProperty::GetDstObject()

<?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> <class>MainWindow</class> <widget class="QMainWindow" name="MainWindow"> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>1026</width> <height>600</height> </rect> </property> <property name="windowTitle"> <string>MainWindow</string> </property> <widget class="QWidget" name="centralwidget"> <widget class="QPushButton" name="pb_led"> <property name="geometry"> <rect> <x>70</x> <y>260</y> <width>101</width> <height>81</height> </rect> </property> <property name="text"> <string>开灯</string> </property> </widget> <widget class="QLineEdit" name="hostname"> <property name="geometry"> <rect> <x>140</x> <y>44</y> <width>151</width> <height>31</height> </rect> </property> <property name="text"> <string>mqtt.yyzlab.com.cn</string> </property> </widget> <widget class="QLineEdit" name="le_port"> <property name="geometry"> <rect> <x>140</x> <y>80</y> <width>151</width> <height>31</height> </rect> </property> <property name="text"> <string>1883</string> </property> </widget> <widget class="QPushButton" name="pb_connect"> <property name="geometry"> <rect> <x>350</x> <y>80</y> <width>89</width> <height>25</height> </rect> </property> <property name="text"> <string>连接</string> </property> </widget> <widget class="QLabel" name="label"> <property name="geometry"> <rect> <x>70</x> <y>50</y> <width>67</width> <height>17</height> </rect> </property> <property name="text"> <string>服务器:</string> </property> </widget> <widget class="QLabel" name="label_2"> <property name="geometry"> <rect> <x>70</x> <y>90</y> <width>67</width> <height>17</height> </rect> </property> <property name="text"> <string>端 口:</string> </property> </widget> <widget class="QLabel" name="label_3"> <property name="geometry"> <rect> <x>60</x> <y>130</y> <width>67</width> <height>17</height> </rect> </property> <property name="text"> <string>发布主题:</string> </property> </widget> <widget class="QLineEdit" name="pub_topic"> <property name="geometry"> <rect> <x>140</x> <y>120</y> <width>151</width> <height>31</height> </rect> </property> <property name="text"> <string/> </property> </widget> <widget class="QLabel" name="label_6"> <property name="geometry"> <rect> <x>60</x> <y>170</y> <width>67</width> <height>17</height> </rect> </property> <property name="text"> <string>订阅主题:</string> </property> </widget> <widget class="QLineEdit" name="sub_topic"> <property name="geometry"> <rect> <x>140</x> <y>160</y> <width>151</width> <height>31</height> </rect> </property> <property name="text"> <string>1752391726490/AIOTSIM2Device</string> </property> </widget> <widget class="QPushButton" name="pb_fan"> <property name="geometry"> <rect> <x>400</x> <y>260</y> <width>101</width> <height>81</height> </rect> </property> <property name="text"> <string>风扇开</string> </property> </widget> <widget class="QLabel" name="label_4"> <property name="geometry"> <rect> <x>100</x> <y>350</y> <width>67</width> <height>17</height> </rect> </property> <property name="text"> <string>电灯1</string> </property> </widget> <widget class="QPushButton" name="pb_led_2"> <property name="geometry"> <rect> <x>210</x> <y>260</y> <width>101</width> <height>81</height> </rect> </property> <property name="text"> <string>开灯</string> </property> </widget> <widget class="QLabel" name="label_5"> <property name="geometry"> <rect> <x>240</x> <y>350</y> <width>67</width> <height>17</height> </rect> </property> <property name="text"> <string>电灯2</string> </property> </widget> <widget class="QLabel" name="label_tem"> <property name="geometry"> <rect> <x>550</x> <y>120</y> <width>100</width> <height>40</height> </rect> </property> <property name="text"> <string>温度:-- ℃</string> </property> <property name="alignment"> <set>Qt::AlignCenter</set> </property> </widget> <widget class="QLabel" name="label_hum"> <property name="geometry"> <rect> <x>550</x> <y>180</y> <width>100</width> <height>40</height> </rect> </property> <property name="text"> <string>湿度:-- %</string> </property> <property name="alignment"> <set>Qt::AlignCenter</set> </property> </widget> <widget class="QLabel" name="label_light"> <property name="geometry"> <rect> <x>550</x> <y>240</y> <width>100</width> <height>40</height> </rect> </property> <property name="text"> <string>光照:-- lux</string> </property> <property name="alignment"> <set>Qt::AlignCenter</set> </property> </widget> <widget class="QLabel" name="label_people"> <property name="geometry"> <rect> <x>550</x> <y>300</y> <width>100</width> <height>40</height> </rect> </property> <property name="text"> <string>人体红外:无人</string> </property> <property name="alignment"> <set>Qt::AlignCenter</set> </property> </widget> <widget class="QLabel" name="label_sensor_pub"> <property name="geometry"> <rect> <x>60</x> <y>210</y> <width>67</width> <height>17</height> </rect> </property> <property name="text"> <string>传感器发布主题:</string> </property> </widget> <widget class="QLineEdit" name="sensor_pub_topic"> <property name="geometry"> <rect> <x>140</x> <y>200</y> <width>151</width> <height>31</height> </rect> </property> <property name="text"> <string>1752391726490/Device2AIOTSIM</string> </property> </widget> <widget class="QPushButton" name="disable"> <property name="geometry"> <rect> <x>930</x> <y>0</y> <width>89</width> <height>25</height> </rect> </property> <property name="text"> <string>关闭</string> </property> </widget> <widget class="QPushButton" name="pb_led_3"> <property name="geometry"> <rect> <x>70</x> <y>380</y> <width>101</width> <height>81</height> </rect> </property> <property name="text"> <string>开灯</string> </property> </widget> <widget class="QLabel" name="label_7"> <property name="geometry"> <rect> <x>100</x> <y>470</y> <width>67</width> <height>17</height> </rect> </property> <property name="text"> <string>电灯3</string> </property> </widget> <widget class="QPushButton" name="pb_fan_speed_up"> <property name="geometry"> <rect> <x>400</x> <y>380</y> <width>101</width> <height>40</height> </rect> </property> <property name="text"> <string>风扇加速</string> </property> </widget> <widget class="QPushButton" name="pb_fan_speed_down"> <property name="geometry"> <rect> <x>400</x> <y>420</y> <width>101</width> <height>40</height> </rect> </property> <property name="text"> <string>风扇减速</string> </property> </widget> <widget class="QLabel" name="label_8"> <property name="geometry"> <rect> <x>420</x> <y>350</y> <width>67</width> <height>17</height> </rect> </property> <property name="text"> <string>风扇</string> </property> </widget> <widget class="QPushButton" name="pb_beeper"> <property name="geometry"> <rect> <x>560</x> <y>390</y> <width>101</width> <height>81</height> </rect> </property> <property name="text"> <string>蜂鸣器开</string> </property> </widget> <widget class="QLabel" name="label_9"> <property name="geometry"> <rect> <x>580</x> <y>350</y> <width>67</width> <height>17</height> </rect> </property> <property name="text"> <string>蜂鸣器</string> </property> </widget> <widget class="QLabel" name="camera_label"> <property name="geometry"> <rect> <x>680</x> <y>90</y> <width>461</width> <height>331</height> </rect> </property> <property name="styleSheet"> <string notr="true">border: 2px solid gray;</string> </property> <property name="text"> <string>摄像头预览区域</string> </property> <property name="alignment"> <set>Qt::AlignCenter</set> </property> </widget> <widget class="QPushButton" name="pb_camera"> <property name="geometry"> <rect> <x>780</x> <y>20</y> <width>101</width> <height>40</height> </rect> </property> <property name="text"> <string>开启摄像头</string> </property> </widget> <widget class="QLabel" name="label_10"> <property name="geometry"> <rect> <x>700</x> <y>50</y> <width>67</width> <height>17</height> </rect> </property> <property name="text"> <string>摄像头</string> </property> </widget> <widget class="QLabel" name="label_fan_speed_title"> <property name="geometry"> <rect> <x>310</x> <y>150</y> <width>80</width> <height>40</height> </rect> </property> <property name="text"> <string>当前风速:</string> </property> <property name="alignment"> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> </property> </widget> <widget class="QLabel" name="label_fan_speed"> <property name="geometry"> <rect> <x>390</x> <y>150</y> <width>101</width> <height>40</height> </rect> </property> <property name="text"> <string>风速:--</string> </property> <property name="alignment"> <set>Qt::AlignCenter</set> </property> </widget> <widget class="QLabel" name="label_fan_speed_topic"> <property name="geometry"> <rect> <x>310</x> <y>200</y> <width>80</width> <height>30</height> </rect> </property> <property name="text"> <string>风速主题:</string> </property> <property name="alignment"> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> </property> </widget> <widget class="QLineEdit" name="fan_speed_topic"> <property name="geometry"> <rect> <x>390</x> <y>200</y> <width>151</width> <height>30</height> </rect> </property> <property name="text"> <string>fan/speed</string> </property> </widget> <widget class="QPushButton" name="pb_doorlock"> <property name="geometry"> <rect> <x>470</x> <y>70</y> <width>101</width> <height>40</height> </rect> </property> <property name="text"> <string>门锁开</string> </property> </widget> </widget> <widget class="QMenuBar" name="menubar"> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>1026</width> <height>28</height> </rect> </property> </widget> <widget class="QStatusBar" name="statusbar"/> </widget> <resources/> <connections/> </ui> 优化该UI界面布局,但是不能更改控件名文本
最新发布
07-22
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值