forked from AcademySoftwareFoundation/MaterialX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProperty.cpp
60 lines (49 loc) · 1.27 KB
/
Property.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//
// TM & (c) 2017 Lucasfilm Entertainment Company Ltd. and Lucasfilm Ltd.
// All rights reserved. See LICENSE.txt for license.
//
#include <MaterialXCore/Property.h>
#include <MaterialXCore/Document.h>
namespace MaterialX
{
const string PropertyAssign::PROPERTY_ATTRIBUTE = "property";
const string PropertyAssign::GEOM_ATTRIBUTE = "geom";
const string PropertyAssign::COLLECTION_ATTRIBUTE = "collection";
const string PropertySetAssign::PROPERTY_SET_ATTRIBUTE = "propertyset";
//
// PropertyAssign methods
//
void PropertyAssign::setCollection(ConstCollectionPtr collection)
{
if (collection)
{
setCollectionString(collection->getName());
}
else
{
removeAttribute(COLLECTION_ATTRIBUTE);
}
}
CollectionPtr PropertyAssign::getCollection() const
{
return resolveRootNameReference<Collection>(getCollectionString());
}
//
// PropertySetAssign methods
//
void PropertySetAssign::setPropertySet(ConstPropertySetPtr propertySet)
{
if (propertySet)
{
setPropertySetString(propertySet->getName());
}
else
{
removeAttribute(PROPERTY_SET_ATTRIBUTE);
}
}
PropertySetPtr PropertySetAssign::getPropertySet() const
{
return resolveRootNameReference<PropertySet>(getPropertySetString());
}
} // namespace MaterialX