Improve guidepost editor placement and rotation

* Shows correct size in preview (by setting the scaling on the definition instead of in Construction)
* Can be oversized
* Avoid angles where all signs are facing parallel to the camera
* Unfortunately, rotation doesn't work well with Mesh Transform (uses the wrong rotation center for the graphics)
directional-lights
Sven Eberhardt 2016-10-31 00:34:48 -04:00
parent 5c5e1a5fa3
commit 8e281103b0
4 changed files with 23 additions and 6 deletions

View File

@ -4,4 +4,5 @@ Category=C4D_StaticBack
Width=10
Height=36
Offset=-5,-18
StretchGrowth=1
StretchGrowth=1
Oversize=1

View File

@ -33,13 +33,19 @@ public func SetInscription(to_text)
// Color for messages
public func GetColor() { return 0xffcf9c1a; }
public func Construction()
protected func Construction()
{
SetProperty("MeshTransformation", Trans_Mul(Trans_Rotate(RandomX(-180,180),0,10), Trans_Scale(360)));
// Pick an angle range that looks good (some angles show it from the side, which looks weird)
var angle;
if (!Random(2)) angle = -80 + Random(105); else angle = 90 + Random(110);
this.MeshTransformation = Trans_Mul(Trans_Rotate(angle,0,10), GetID().MeshTransformation);
}
public func Definition(def)
{
// Model file is way too large
def.MeshTransformation = Trans_Scale(360);
// Inscription props
if (!def.EditorProps) def.EditorProps = {};
def.EditorProps.inscription = { Name="$Inscription$", Type="string", EditorHelp="$InscriptionHelp$", Set="SetInscription", Save="Inscription" };
}

View File

@ -4,4 +4,5 @@ Category=C4D_StaticBack
Width=10
Height=30
Offset=-5,-15
StretchGrowth=1
StretchGrowth=1
Oversize=1

View File

@ -9,5 +9,14 @@ local Description="$Description$";
protected func Construction()
{
SetProperty("MeshTransformation", Trans_Mul(Trans_Rotate(RandomX(-180,180),0,10), Trans_Scale(130)));
}
// Pick an angle range that looks good (some angles show it from the side, which looks weird)
var angle;
if (!Random(2)) angle = -60 + Random(90); else angle = 120 + Random(90);
this.MeshTransformation = Trans_Mul(Trans_Rotate(angle,0,10), GetID().MeshTransformation);
}
public func Definition(def)
{
// Model file is way too large
def.MeshTransformation = Trans_Scale(130);
}