Select one or many point cloud objects and run.
I hope that help you.
2015-02-03 19:28 GMT+01:00 Eric Thivierge <[email protected]>:
> Sure I'll have a look at the script if you have it handy.
>
> Thanks,
> Eric T.
>
>
> On 2/3/2015 1:18 PM, julien carmagnac wrote:
>
> Hello,
>
> At least, a simple script can read point clouds data and create all
> instance objects (can be critic if you have many many particles).
> I can share my script if you are interested.
>
> Julien.
>
> 2015-02-03 17:14 GMT+01:00 Mario Reitbauer <[email protected]>:
>
>> In case we are talking about static instances then I would export the
>> particles and instance again in maya.
>>
>> Otherwise Momentum got a tool called "Instancer" which should do what
>> you want.
>>
>> Or this here:
>> http://www.si-community.com/community/viewtopic.php?f=19&t=3588
>>
>> And probably the most reason tool would be emTopolizer 2 from mootzoid.
>>
>> 2015-02-03 17:07 GMT+01:00 Eric Thivierge <[email protected]>:
>>
>>> Hi all,
>>>
>>> We need to back out some ICE instances to geometry with UVs to transfer
>>> over to Maya. What's the best way to go about this? I thought I'd seen one
>>> of the Mootzoid plug-ins able to do this but not sure which one it was or
>>> whether actual UVs were generated or if they are just ICE based.
>>>
>>> Any help is appreciated as always,
>>>
>>> Eric T.
>>>
>>>
>>
>
>
Set maSelection = CreateObject("XSI.Collection")
maSelection.AddItems Application.Selection
auMoinsUnPointCloudTrouve = false
SetUserPref siScrCommandLogEnabled , FALSE
for each objEnCour in maSelection
if objEnCour.Type = "pointcloud" then
opereSurPointCloud objEnCour
auMoinsUnPointCloudTrouve = true
end if
next
if not auMoinsUnPointCloudTrouve then
logMessage "Selectionnez un(ou plusieurs) objet de type ""Point
Cloud"".", siwarning
end if
sub opereSurPointCloud(ByRef inPointCloud)
logMessage "inPointCloud.FullName = " & inPointCloud.FullName
set monNullRangement = GetPrim("Null", inPointCloud.Name & "_instance")
DeselectAll
set maGeometrie = inPointCloud.ActivePrimitive.Geometry
' for each attributEnCour in maGeometrie.ICEAttributes
' logMessage "attributEnCour.Name = " & attributEnCour.Name
' next
set attributPtPosition =
maGeometrie.GetICEAttributeFromName("PointPosition")
tabDataPtPosition = attributPtPosition.DataArray
set attributSize = maGeometrie.GetICEAttributeFromName("Size")
tabDataSize = attributSize.DataArray
set attributScale = maGeometrie.GetICEAttributeFromName("Scale")
tabDataScale = attributScale.DataArray
set attributOrientation =
maGeometrie.GetICEAttributeFromName("Orientation")
tabDataOrientation = attributOrientation.DataArray
set attributShape = maGeometrie.GetICEAttributeFromName("Shape")
tabDataShape = attributShape.DataArray
'barre de progression
set oProgressBar = XSIUIToolkit.ProgressBar
oProgressBar.Maximum = attributPtPosition.ElementCount
oProgressBar.Step = 1
oProgressBar.CancelEnabled = true
oProgressBar.Caption = inPointCloud.Name
oProgressBar.Visible= true
questionPourLaCreationDunModelParentDejaPose = false
creationDunModelParent = false
dim nouveauModelParent
for cpt = 0 to attributPtPosition.ElementCount - 1
oProgressBar.Caption = inPointCloud.Name & " to Instance (" &
cpt & " / " & attributPtPosition.ElementCount & ")"
oProgressBar.Increment
if oProgressBar.CancelPressed then
exit for
end if
'--- position ---
set monVecteurPos = XSIMath.CreateVector3(1, 1, 1)
'logMessage "TypeName(tabDataPtPosition(cpt)) = " &
TypeName(tabDataPtPosition(cpt))
set monVecteurPos = tabDataPtPosition(cpt)
'logMessage monVecteurPos.X & ", " & monVecteurPos.Y & ", " &
monVecteurPos.Z
'--- size ---
on error resume next
'logMessage "TypeName(tabDataSize(cpt)) = " &
TypeName(tabDataSize(cpt))
size = tabDataSize(cpt)
If Err.Number <> 0 Then
'reinitialise l'objet Err
Err.Clear
'logMessage "pas d'attribut : Size"
size = 1
else
'size = tabDataSize(cpt)
end if
On Error GoTo 0
'--- scale ---
on error resume next
'logMessage "TypeName(tabDataScale(cpt)) = " &
TypeName(tabDataScale(cpt))
set monVecteurScale = tabDataScale(cpt)
If Err.Number <> 0 Then
'reinitialise l'objet Err
Err.Clear
'logMessage "pas d'attribut : Scale"
set monVecteurScale = XSIMath.CreateVector3(1, 1, 1)
else
'set monVecteurScale = tabDataScale(cpt)
end if
On Error GoTo 0
'--- orientation ---
on error resume next
'logMessage "TypeName(tabDataOrientation(cpt)) = " &
TypeName(tabDataOrientation(cpt))
set monVecteurRotation = tabDataOrientation(cpt)
If Err.Number <> 0 Then
'reinitialise l'objet Err
Err.Clear
'logMessage "pas d'attribut : Orientation"
set monVecteurRotation = XSIMath.CreateRotation(0, 0, 0)
else
'size = tabDataSize(cpt)
end if
On Error GoTo 0
'--- shape ---
on error resume next
'logMessage "TypeName(tabDataShape(cpt)) = " &
TypeName(tabDataShape(cpt))
set monObjAInstancier = GetObjectFromID(
tabDataShape(cpt).ReferenceID )
If Err.Number <> 0 Then
'reinitialise l'objet Err
Err.Clear
'logMessage "pas d'attribut : Shape"
set monObjAInstancier = Nothing
else
if monObjAInstancier.Type <> "#model" then
if not
questionPourLaCreationDunModelParentDejaPose then
resultatQuestion =
XSIUIToolkit.MsgBox("The object is not a model, Do you want create a parent
model ?", siMsgBoxFlags.siMsgOkCancel, "Instanciate Mode")
questionPourLaCreationDunModelParentDejaPose = true
if resultatQuestion =
siMsgButtonPressed.siMsgOk then
logMessage "on utilise le model
parent comme modele a instancier"
creationDunModelParent = true
DeselectAll
set nouveauModelParent =
CreateModel(monObjAInstancier.FullName, "Model_" & monObjAInstancier.Name)
DeselectAll
else 'resultatQuestion =
siMsgButtonPressed.siMsgCancel
logMessage "on arrete tout"
creationDunModelParent = false
end if
end if
if not creationDunModelParent then
exit for
end if
end if
'logMessage "par la = "
set monObjAInstancier = GetObjectFromID(
tabDataShape(cpt).ReferenceID )
if creationDunModelParent then
set monObjAInstancier = nouveauModelParent(0)
'set monObjAInstancier =
CreateModel(monObjAInstancier.FullName, "Model_" & monObjAInstancier.Name)
'set monObjAInstancier =
monObjAInstancier.Parent
end if
if monObjAInstancier.Type = "#model" then
'Instantiate( [InputObjs], [NbItems],
[Hierarchy], [Grouping], [Selection], [Xfrom], [Sx], [Sy], [Sz], [Rx], [Ry],
[Rz], [Tx], [Ty], [Tz], [TrackXform] )
set maCollInstance =
Instantiate(monObjAInstancier.FullName,_
1,_
siNoParent,_
siNoGrouping,_
siAddToSelection,_
siGlobalXForm,_
1,_
1,_
1,_
monVecteurRotation.RotX,_
monVecteurRotation.RotY,_
monVecteurRotation.RotZ,_
0,_
0,_
0,_
true)
set monInstance = maCollInstance(0)
monInstance.Kinematics.Global.Parameters("posx").value = monVecteurPos.X
monInstance.Kinematics.Global.Parameters("posy").value = monVecteurPos.Y
monInstance.Kinematics.Global.Parameters("posz").value = monVecteurPos.Z
monInstance.Kinematics.Global.Parameters("rotx").value = monVecteurRotation.RotX
monInstance.Kinematics.Global.Parameters("roty").value = monVecteurRotation.RotY
monInstance.Kinematics.Global.Parameters("rotz").value = monVecteurRotation.RotZ
monInstance.Kinematics.Global.Parameters("sclx").value = monVecteurScale.X *
size
monInstance.Kinematics.Global.Parameters("scly").value = monVecteurScale.Y *
size
monInstance.Kinematics.Global.Parameters("sclz").value = monVecteurScale.Z *
size
end if
end if
On Error GoTo 0
next
ToggleSelection monNullRangement
ParentObjects
end sub