MCPcopy Create free account
hub / github.com/LuxCoreRender/LuxCore / UpdateObjectTransformation

Method UpdateObjectTransformation

src/slg/scene/sceneupdate.cpp:27–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25using namespace slg;
26
27void Scene::UpdateObjectTransformation(const string &objName, const Transform &trans) {
28 if (!objDefs.IsSceneObjectDefined(objName))
29 throw runtime_error("Unknown object in Scene::UpdateObjectTransformation(): " + objName);
30
31 SceneObject *obj = objDefs.GetSceneObject(objName);
32 ExtMesh *mesh = obj->GetExtMesh();
33
34 ExtInstanceTriangleMesh *instanceMesh = dynamic_cast<ExtInstanceTriangleMesh *>(mesh);
35 if (instanceMesh) {
36 instanceMesh->SetTransformation(trans);
37 editActions.AddAction(GEOMETRY_TRANS_EDIT);
38 } else {
39 mesh->ApplyTransform(trans);
40 editActions.AddAction(GEOMETRY_EDIT);
41 }
42
43 // Check if it is a light source
44 if (obj->GetMaterial()->IsLightSource()) {
45 // Have to update all light sources using this mesh
46 for (u_int i = 0; i < mesh->GetTotalTriangleCount(); ++i)
47 lightDefs.GetLightSource(obj->GetName() + TRIANGLE_LIGHT_POSTFIX + ToString(i))->Preprocess();
48
49 editActions.AddActions(LIGHTS_EDIT | LIGHT_TYPES_EDIT);
50 }
51}
52
53void Scene::UpdateObjectMaterial(const string &objName, const string &matName) {
54 if (!objDefs.IsSceneObjectDefined(objName))

Callers

nothing calls this directly

Calls 13

IsSceneObjectDefinedMethod · 0.80
GetSceneObjectMethod · 0.80
SetTransformationMethod · 0.80
AddActionMethod · 0.80
AddActionsMethod · 0.80
ToStringFunction · 0.50
GetExtMeshMethod · 0.45
ApplyTransformMethod · 0.45
IsLightSourceMethod · 0.45
GetMaterialMethod · 0.45
GetTotalTriangleCountMethod · 0.45
PreprocessMethod · 0.45

Tested by

no test coverage detected