Folge dem Video um zu sehen, wie unsere Website als Web-App auf dem Startbildschirm installiert werden kann.
Anmerkung: Diese Funktion ist in einigen Browsern möglicherweise nicht verfügbar.
main(doc,op)
{
// Parameter; array = Anzahl der Durchgänge
var G_select = new(array,3);
var G_extrude = new(array,3);
var G_bevel = new(array,3);
var G_inner = new(array,3);
// 1.Durchgang
G_select[0] = 0.9;
G_extrude[0] = 5;
G_bevel[0] = 0;
G_inner[0] = 3;
// 2.Durchgang
G_select[1] = 0.7;
G_extrude[1] = 4;
G_bevel[1] = 0;
G_inner[1] = 2;
// 3.Durchgang
G_select[2] = 0.5;
G_extrude[2] = 3;
G_bevel[2] = 0;
G_inner[2] = 0;
// Abschluß
var G_all_inner = 0.1;
var G_all_offset = -2;
// Gibt's etwas zu greeblen?
var use = op->GetDown();
if (!use) { return; }
// Wurde bereits gegreebled?
var obj = use->GetNext();
if (obj) { return; }
// Gegreebled wird nur ein Clone
obj = use->GetClone(CL_NO_HIERARCHY);
obj->InsertUnder(op);
obj->SetEditorMode(MODE_ON);
obj->SetRenderMode(MODE_ON);
// Original ausblenden
use->SetEditorMode(MODE_OFF);
use->SetRenderMode(MODE_OFF);
// Greeble --------------------------------------------------
var j;
for(j=0; j<sizeof(G_select);j++) {
// Selection verkleinern
var random = new(Random);
random->Init(1234567);
var select = obj->GetPolygonSelection();
var i;
for(i=0; i < obj->GetPolygonCount(); i++) {
if (select->IsSelected(i) && random->Get01()>G_select[j]) {
select->Deselect(i);
}
}
obj->SetPolygonSelection(select);
// Extrude & Bevel
if (G_extrude[j]) {
var bc = new(BaseContainer);
bc->SetData(MDATA_BEVEL_OFFSET1, G_extrude[j]);
bc->SetData(MDATA_BEVEL_OFFSET2, G_bevel[j]);
bc->SetData(MDATA_BEVEL_PRESERVEGROUPS, true);
bc->SetData(MDATA_BEVEL_ANGLE, pi/4);
var result = SendModelingCommand(ID_MODELING_BEVEL_TOOL,doc,obj,bc,MODIFY_POLYGONSELECTION);
}
// Inner Extrude
if (G_inner[j]) {
var bc = new(BaseContainer);
bc->SetData(MDATA_EXTRUDEINNER_OFFSET, G_inner[j]);
bc->SetData(MDATA_EXTRUDEINNER_PRESERVEGROUPS, true);
bc->SetData(MDATA_EXTRUDEINNER_ANGLE, pi/4);
var result = SendModelingCommand(ID_MODELING_EXTRUDE_INNER_TOOL,doc,obj,bc,MODIFY_POLYGONSELECTION);
}
}
// Abschluß: Select all
var select = new(BaseSelect);
var i;
for(i=0; i < obj->GetPolygonCount(); i++) {
select->Select(i);
}
obj->SetPolygonSelection(select);
// Abschluß: Inner Extrude
var bc = new(BaseContainer);
bc->SetData(MDATA_EXTRUDEINNER_OFFSET, G_all_inner);
bc->SetData(MDATA_EXTRUDEINNER_PRESERVEGROUPS, true);
bc->SetData(MDATA_EXTRUDEINNER_ANGLE, pi/4);
var result = SendModelingCommand(ID_MODELING_EXTRUDE_INNER_TOOL,doc,obj,bc,MODIFY_POLYGONSELECTION);
// Abschluß: Extrude
bc->SetData(MDATA_EXTRUDE_OFFSET, G_all_offset);
bc->SetData(MDATA_EXTRUDE_PRESERVEGROUPS, true);
bc->SetData(MDATA_EXTRUDE_ANGLE, pi/4);
var result = SendModelingCommand(ID_MODELING_EXTRUDE_TOOL,doc,obj,bc,MODIFY_POLYGONSELECTION);
}