Skip to content

Commit cbe67a9

Browse files
committed
reworked some enums
1 parent 5143ce7 commit cbe67a9

13 files changed

+44
-44
lines changed

Animation capture.lua

+3-3
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function sysCall_selChange(inData)
5959
for i = 1, #tmp, 1 do
6060
local obj = tmp[i]
6161
if sim.getObjectInt32Param(obj, sim.objintparam_visible) ~= 0 and
62-
sim.getObjectType(obj) == sim.object_shape_type then
62+
sim.getObjectType(obj) == sim.sceneobject_shape then
6363
cnt = cnt + 1
6464
end
6565
end
@@ -100,7 +100,7 @@ function sysCall_beforeSimulation()
100100
for i = 1, #tmp, 1 do
101101
local obj = tmp[i]
102102
if sim.getObjectInt32Param(obj, sim.objintparam_visible) ~= 0 and sim.getObjectType(obj) ==
103-
sim.object_shape_type then
103+
sim.sceneobject_shape then
104104
map[obj] = true
105105
cnt = cnt + 1
106106
end
@@ -227,7 +227,7 @@ function sysCall_afterSimulation()
227227
sim.setObjectSel({dummy})
228228
local txt = "Animation model '" .. sim.getObjectAlias(dummy, 1) .. "' was created!"
229229
sim.addLog(sim.verbosity_scriptinfos, txt)
230-
simUI.msgBox(simUI.msgbox_type.info, sim.msgbox_buttons.ok, 'Animation model', txt)
230+
simUI.msgBox(simUI.msgbox_type.info, simUI.msgbox_buttons.ok, 'Animation model', txt)
231231
end
232232
end
233233

Collision check.lua

+10-10
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ end
1414

1515
function couldCollide(obj, typ, ignoreModelOverride)
1616
local retVal = false
17-
if typ == sim.object_shape_type or typ == sim.object_octree_type or typ ==
18-
sim.object_pointcloud_type or typ == sim.object_dummy_type then
17+
if typ == sim.sceneobject_shape or typ == sim.sceneobject_octree or typ ==
18+
sim.sceneobject_pointcloud or typ == sim.sceneobject_dummy then
1919
if sim.getObjectSpecialProperty(obj) & sim.objectspecialproperty_collidable > 0 then
2020
-- Check if the object is possibly part of a model that has a collidable flag override:
2121
retVal = true
@@ -185,13 +185,13 @@ function coll(ui, id)
185185
objPair[i], sim.objintparam_visibility_layer, 0
186186
)
187187
local copy
188-
if t[i] == sim.object_dummy_type then
188+
if t[i] == sim.sceneobject_dummy then
189189
copy = sim.createDummy(0.01, getCol(i))
190190
sim.setObjectPose(
191191
copy, sim.getObjectPose(objPair[i])
192192
)
193193
end
194-
if t[i] == sim.object_shape_type then
194+
if t[i] == sim.sceneobject_shape then
195195
copy = sim.copyPasteObjects(
196196
{objPair[i]}, 2 + 4 + 8 + 16 + 32
197197
)[1]
@@ -208,7 +208,7 @@ function coll(ui, id)
208208
{0, 0, 0}
209209
)
210210
end
211-
if t[i] == sim.object_octree_type then
211+
if t[i] == sim.sceneobject_octree then
212212
copy = sim.copyPasteObjects(
213213
{objPair[i]}, 2 + 4 + 8 + 16 + 32
214214
)[1]
@@ -218,7 +218,7 @@ function coll(ui, id)
218218
getCol(i, true)
219219
)
220220
end
221-
if t[i] == sim.object_pointcloud_type then
221+
if t[i] == sim.sceneobject_pointcloud then
222222
copy = sim.createPointCloud(0.1, 50, 8, 4)
223223
sim.setObjectPose(
224224
copy, sim.getObjectPose(objPair[i])
@@ -365,13 +365,13 @@ function update()
365365
if #s >= 1 and #s <= 2 then
366366
obj1IsModel = (sim.getModelProperty(s[1]) & sim.modelproperty_not_model) == 0
367367
local t = sim.getObjectType(s[1])
368-
if t == sim.object_shape_type or t == sim.object_dummy_type or t == sim.object_octree_type or
369-
t == sim.object_pointcloud_type or obj1IsModel then o1 = s[1] end
368+
if t == sim.sceneobject_shape or t == sim.sceneobject_dummy or t == sim.sceneobject_octree or
369+
t == sim.sceneobject_pointcloud or obj1IsModel then o1 = s[1] end
370370
if #s == 2 then
371371
obj2IsModel = (sim.getModelProperty(s[2]) & sim.modelproperty_not_model) == 0
372372
local t = sim.getObjectType(s[2])
373-
if t == sim.object_shape_type or t == sim.object_dummy_type or t ==
374-
sim.object_octree_type or t == sim.object_pointcloud_type or obj2IsModel then
373+
if t == sim.sceneobject_shape or t == sim.sceneobject_dummy or t ==
374+
sim.sceneobject_octree or t == sim.sceneobject_pointcloud or obj2IsModel then
375375
o2 = s[2]
376376
else
377377
o1 = -1

Color changer.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ function getAlsoModelObjectsAndOnlyVisibleShapes(sel)
288288
local p = sim.getModelProperty(sel[i])
289289
if (p & sim.modelproperty_not_model) == 0 then
290290
-- We have a model
291-
local modObjs = sim.getObjectsInTree(sel[i], sim.object_shape_type)
291+
local modObjs = sim.getObjectsInTree(sel[i], sim.sceneobject_shape)
292292
for k = 1, #modObjs, 1 do
293293
local addIt = true
294294
for j = 1, #tsel, 1 do
@@ -301,7 +301,7 @@ function getAlsoModelObjectsAndOnlyVisibleShapes(sel)
301301
end
302302
else
303303
-- We do not have a model
304-
if sim.getObjectType(sel[i]) == sim.object_shape_type then
304+
if sim.getObjectType(sel[i]) == sim.sceneobject_shape then
305305
-- We have a shape
306306
local addIt = true
307307
for j = 1, #tsel, 1 do

Define joint group.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ function sysCall_init()
2323
-- filter by joints:
2424
local joints = {}
2525
for _, handle in ipairs(sel) do
26-
if sim.getObjectType(handle) == sim.object_joint_type then
27-
if sim.getJointType(handle) ~= sim.joint_spherical_subtype then
26+
if sim.getObjectType(handle) == sim.sceneobject_joint then
27+
if sim.getJointType(handle) ~= sim.joint_spherical then
2828
table.insert(joints, handle)
2929
end
3030
end

Denavit Hartenberg creator.lua

+3-3
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ end
138138
function buildJoint(revoluteJoint)
139139
local sel = sim.getObjectSel()
140140
local objMatr = sim.getObjectMatrix(sel[1])
141-
if sim.getObjectType(sel[1]) == sim.object_joint_type then
141+
if sim.getObjectType(sel[1]) == sim.sceneobject_joint then
142142
objMatr = sim.multiplyMatrices(objMatr, sim.poseToMatrix(sim.getObjectChildPose(sel[1]))) -- don't forget the joint's intrinsic transformation
143143
end
144144
local m1 = sim.buildMatrix({0, 0, d}, {0, 0, theta})
@@ -147,9 +147,9 @@ function buildJoint(revoluteJoint)
147147
objMatr = sim.multiplyMatrices(objMatr, m)
148148
local newJoint = -1
149149
if revoluteJoint then
150-
newJoint = sim.createJoint(sim.joint_revolute_subtype, sim.jointmode_force, 0)
150+
newJoint = sim.createJoint(sim.joint_revolute, sim.jointmode_force, 0)
151151
else
152-
newJoint = sim.createJoint(sim.joint_prismatic_subtype, sim.jointmode_force, 0)
152+
newJoint = sim.createJoint(sim.joint_prismatic, sim.jointmode_force, 0)
153153
end
154154
sim.setObjectMatrix(newJoint, objMatr)
155155
sim.setObjectParent(newJoint, sel[1], true)

Denavit Hartenberg extractor.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function sysCall_init()
1616
local jointsAndEndEffector = {}
1717
local obj = sel[1]
1818
while obj ~= -1 do
19-
if sim.getObjectType(obj) == sim.object_joint_type or #jointsAndEndEffector == 0 then
19+
if sim.getObjectType(obj) == sim.sceneobject_joint or #jointsAndEndEffector == 0 then
2020
table.insert(jointsAndEndEffector, 1, obj)
2121
end
2222
obj = sim.getObjectParent(obj)
@@ -26,7 +26,7 @@ function sysCall_init()
2626
for i = 1, #jointsAndEndEffector - 1 do
2727
local dhParams = getDHParams(jointsAndEndEffector[i], jointsAndEndEffector[i + 1])
2828
local onn = 'joint'
29-
if i == #jointsAndEndEffector - 1 and sim.getObjectType(sel[1]) ~= sim.object_joint_type then
29+
if i == #jointsAndEndEffector - 1 and sim.getObjectType(sel[1]) ~= sim.sceneobject_joint then
3030
onn = 'object'
3131
end
3232
print(

Distance check.lua

+4-4
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,13 @@ function update()
142142
if #s >= 1 and #s <= 2 then
143143
obj1IsModel = (sim.getModelProperty(s[1]) & sim.modelproperty_not_model) == 0
144144
local t = sim.getObjectType(s[1])
145-
if t == sim.object_shape_type or t == sim.object_dummy_type or t == sim.object_octree_type or
146-
t == sim.object_pointcloud_type or obj1IsModel then o1 = s[1] end
145+
if t == sim.sceneobject_shape or t == sim.sceneobject_dummy or t == sim.sceneobject_octree or
146+
t == sim.sceneobject_pointcloud or obj1IsModel then o1 = s[1] end
147147
if #s == 2 then
148148
obj2IsModel = (sim.getModelProperty(s[2]) & sim.modelproperty_not_model) == 0
149149
local t = sim.getObjectType(s[2])
150-
if t == sim.object_shape_type or t == sim.object_dummy_type or t ==
151-
sim.object_octree_type or t == sim.object_pointcloud_type or obj2IsModel then
150+
if t == sim.sceneobject_shape or t == sim.sceneobject_dummy or t ==
151+
sim.sceneobject_octree or t == sim.sceneobject_pointcloud or obj2IsModel then
152152
o2 = s[2]
153153
else
154154
o1 = -1

Joint tool.lua

+4-4
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function sysCall_selChange(inData)
5555
local dat = sim.readCustomBufferData(objectHandle, '__jointGroup__')
5656
if dat and #dat > 0 then
5757
for j, jointHandle in ipairs(sim.getReferencedHandles(objectHandle)) do
58-
if sim.getObjectType(jointHandle) == sim.object_joint_type then
58+
if sim.getObjectType(jointHandle) == sim.sceneobject_joint then
5959
table.insert(jointHandles, jointHandle)
6060
else
6161
sim.addLog(
@@ -67,10 +67,10 @@ function sysCall_selChange(inData)
6767
end
6868
end
6969
elseif sim.getModelProperty(objectHandle) & sim.modelproperty_not_model == 0 then
70-
for j, jointHandle in ipairs(sim.getObjectsInTree(objectHandle, sim.object_joint_type)) do
70+
for j, jointHandle in ipairs(sim.getObjectsInTree(objectHandle, sim.sceneobject_joint)) do
7171
table.insert(jointHandles, jointHandle)
7272
end
73-
elseif sim.getObjectType(objectHandle) == sim.object_joint_type then
73+
elseif sim.getObjectType(objectHandle) == sim.sceneobject_joint then
7474
table.insert(jointHandles, objectHandle)
7575
else
7676
sim.addLog(
@@ -85,7 +85,7 @@ function sysCall_selChange(inData)
8585
local nid = 1
8686
closeUi()
8787
for i, jointHandle in ipairs(jointHandles) do
88-
local isSpherical = sim.getJointType(jointHandle) == sim.joint_spherical_subtype
88+
local isSpherical = sim.getJointType(jointHandle) == sim.joint_spherical
8989
local mh, a, b = sim.getJointDependency(jointHandle)
9090
if not isSpherical and mh == -1 and not jointToIdMap[jointHandle] then
9191
jointToIdMap[jointHandle] = nid

Make objects same appearance.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ end
66

77
function sysCall_init()
88
local sel = sim.getObjectSel()
9-
local shapes = filter(function(h) return sim.getObjectType(h) == sim.object_shape_type end, sel)
9+
local shapes = filter(function(h) return sim.getObjectType(h) == sim.sceneobject_shape end, sel)
1010
if #shapes < 2 then
1111
simUI = require 'simUI'
1212
simUI.msgBox(

Minimalistic exporter.lua

+5-5
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ function sysCall_init()
9999
file:write(" parent{" .. parentId .. "}")
100100
file:write(" visibility{" .. sim.boolAnd32(visibleLayers, layers) .. "}")
101101
file:write(" type{")
102-
if objType == sim.object_shape_type then
102+
if objType == sim.sceneobject_shape then
103103
local param = sim.getObjectInt32Param(allObjects[obji], 3016)
104104
if exportIndividualShapeComponents and (param ~= 0) then
105105
file:write("multishape}")
@@ -171,11 +171,11 @@ function sysCall_init()
171171
end
172172
end
173173
else
174-
if objType == sim.object_joint_type then
174+
if objType == sim.sceneobject_joint then
175175
file:write("joint}")
176176
local t = sim.getJointType(allObjects[obji])
177177
local cyclic, interval = sim.getJointInterval(allObjects[obji])
178-
if t == sim.joint_prismatic_subtype then
178+
if t == sim.joint_prismatic then
179179
local pos = sim.getJointPosition(allObjects[obji])
180180
file:write(
181181
string.format(
@@ -184,7 +184,7 @@ function sysCall_init()
184184
)
185185
)
186186
end
187-
if t == sim.joint_revolute_subtype then
187+
if t == sim.joint_revolute then
188188
local pos = sim.getJointPosition(allObjects[obji])
189189
if cyclic then
190190
file:write(
@@ -201,7 +201,7 @@ function sysCall_init()
201201
)
202202
end
203203
end
204-
if t == sim.joint_spherical_subtype then
204+
if t == sim.joint_spherical then
205205
local jmatr = sim.getJointMatrix(allObjects[obji])
206206
file:write("\n type{spherical} position{")
207207
for i = 1, 12, 1 do

Minimalistic importer.lua

+3-3
Original file line numberDiff line numberDiff line change
@@ -135,14 +135,14 @@ function sysCall_init()
135135
end
136136
if jointType == "prismatic" then
137137
objHandle = sim.createJoint(
138-
sim.joint_prismatic_subtype, sim.jointmode_kinematic, 0
138+
sim.joint_prismatic, sim.jointmode_kinematic, 0
139139
)
140140
sim.setJointInterval(objHandle, false, limits)
141141
sim.setJointPosition(objHandle, tonumber(position))
142142
end
143143
if jointType == "revolute" then
144144
objHandle = sim.createJoint(
145-
sim.joint_revolute_subtype, sim.jointmode_kinematic, 0
145+
sim.joint_revolute, sim.jointmode_kinematic, 0
146146
)
147147
if limits then
148148
sim.setJointInterval(objHandle, false, limits)
@@ -153,7 +153,7 @@ function sysCall_init()
153153
end
154154
if jointType == "spherical" then
155155
objHandle = sim.createJoint(
156-
sim.joint_spherical_subtype, sim.jointmode_kinematic, 0
156+
sim.joint_spherical, sim.jointmode_kinematic, 0
157157
)
158158
sim.setJointInterval(objHandle, false, {math.pi, 2 * math.pi})
159159
sim.setSphericalJointMatrix(objHandle, getNumberTable(position))

Screenshot tool.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ end
5757

5858
function sysCall_selChange(inData)
5959
local s = inData.sel
60-
if #s == 1 and (sim.getObjectType(s[1]) == sim.object_camera_type or sim.getObjectType(s[1]) ==
61-
sim.object_visionsensor_type) then
60+
if #s == 1 and (sim.getObjectType(s[1]) == sim.sceneobject_camera or sim.getObjectType(s[1]) ==
61+
sim.sceneobject_visionsensor) then
6262
cam = s[1]
6363
showDlg()
6464
else

Script capture.lua

+3-3
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ function onObjectAdded(handle)
9393
local code = ''
9494
local objType = sim.getObjectType(handle)
9595
local id = objectId(handle)
96-
if objType == sim.object_shape_type then
96+
if objType == sim.sceneobject_shape then
9797
result, pureType, dims = sim.getShapeGeomInfo(handle)
9898
if result & 2 > 0 then
9999
code = string.format(
@@ -105,15 +105,15 @@ function onObjectAdded(handle)
105105
else
106106
code = string.format('%s=sim.createShape(...)', id)
107107
end
108-
elseif objType == sim.object_joint_type then
108+
elseif objType == sim.sceneobject_joint then
109109
local jointType = sim.getJointType(handle)
110110
local jointMode = sim.getJointMode(handle)
111111
code = string.format(
112112
'%s=sim.createJoint(%s,%s,0)', id,
113113
getConstantName(jointType, 'joint_', '_subtype'),
114114
getConstantName(jointMode, 'jointmode_')
115115
)
116-
elseif objType == sim.object_dummy_type then
116+
elseif objType == sim.sceneobject_dummy then
117117
code = string.format('%s=sim.createDummy(0.01)', id)
118118
else
119119
code = id .. '=nil -- not implemented type (type=' ..

0 commit comments

Comments
 (0)