Welcome to mirror list, hosted at ThFree Co, Russian Federation.

deg_builder_relations_keys.cc « builder « intern « depsgraph « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2220ba6ee138d805d687792c28f3fce819b2e6f4 (plain)
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
/*
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 * The Original Code is Copyright (C) 2013 Blender Foundation.
 * All rights reserved.
 */

/** \file
 * \ingroup depsgraph
 *
 * Methods for constructing depsgraph
 */

#include "intern/builder/deg_builder_relations.h"

namespace blender {
namespace deg {

////////////////////////////////////////////////////////////////////////////////
// Time source.

TimeSourceKey::TimeSourceKey() : id(nullptr)
{
}

TimeSourceKey::TimeSourceKey(ID *id) : id(id)
{
}

string TimeSourceKey::identifier() const
{
  return string("TimeSourceKey");
}

////////////////////////////////////////////////////////////////////////////////
// Component.

ComponentKey::ComponentKey() : id(nullptr), type(NodeType::UNDEFINED), name("")
{
}

ComponentKey::ComponentKey(ID *id, NodeType type, const char *name)
    : id(id), type(type), name(name)
{
}

string ComponentKey::identifier() const
{
  const char *idname = (id) ? id->name : "<None>";
  string result = string("ComponentKey(");
  result += idname;
  result += ", " + string(nodeTypeAsString(type));
  if (name[0] != '\0') {
    result += ", '" + string(name) + "'";
  }
  result += ')';
  return result;
}

////////////////////////////////////////////////////////////////////////////////
// Operation.

OperationKey::OperationKey()
    : id(nullptr),
      component_type(NodeType::UNDEFINED),
      component_name(""),
      opcode(OperationCode::OPERATION),
      name(""),
      name_tag(-1)
{
}

OperationKey::OperationKey(ID *id, NodeType component_type, const char *name, int name_tag)
    : id(id),
      component_type(component_type),
      component_name(""),
      opcode(OperationCode::OPERATION),
      name(name),
      name_tag(name_tag)
{
}

OperationKey::OperationKey(
    ID *id, NodeType component_type, const char *component_name, const char *name, int name_tag)
    : id(id),
      component_type(component_type),
      component_name(component_name),
      opcode(OperationCode::OPERATION),
      name(name),
      name_tag(name_tag)
{
}

OperationKey::OperationKey(ID *id, NodeType component_type, OperationCode opcode)
    : id(id),
      component_type(component_type),
      component_name(""),
      opcode(opcode),
      name(""),
      name_tag(-1)
{
}

OperationKey::OperationKey(ID *id,
                           NodeType component_type,
                           const char *component_name,
                           OperationCode opcode)
    : id(id),
      component_type(component_type),
      component_name(component_name),
      opcode(opcode),
      name(""),
      name_tag(-1)
{
}

OperationKey::OperationKey(
    ID *id, NodeType component_type, OperationCode opcode, const char *name, int name_tag)
    : id(id),
      component_type(component_type),
      component_name(""),
      opcode(opcode),
      name(name),
      name_tag(name_tag)
{
}

OperationKey::OperationKey(ID *id,
                           NodeType component_type,
                           const char *component_name,
                           OperationCode opcode,
                           const char *name,
                           int name_tag)
    : id(id),
      component_type(component_type),
      component_name(component_name),
      opcode(opcode),
      name(name),
      name_tag(name_tag)
{
}

string OperationKey::identifier() const
{
  string result = string("OperationKey(");
  result += "type: " + string(nodeTypeAsString(component_type));
  result += ", component name: '" + string(component_name) + "'";
  result += ", operation code: " + string(operationCodeAsString(opcode));
  if (name[0] != '\0') {
    result += ", '" + string(name) + "'";
  }
  result += ")";
  return result;
}

////////////////////////////////////////////////////////////////////////////////
// RNA path.

RNAPathKey::RNAPathKey(ID *id, const char *path, RNAPointerSource source) : id(id), source(source)
{
  /* Create ID pointer for root of path lookup. */
  PointerRNA id_ptr;
  RNA_id_pointer_create(id, &id_ptr);
  /* Try to resolve path. */
  int index;
  if (!RNA_path_resolve_full(&id_ptr, path, &ptr, &prop, &index)) {
    ptr = PointerRNA_NULL;
    prop = nullptr;
  }
}

RNAPathKey::RNAPathKey(ID *id, const PointerRNA &ptr, PropertyRNA *prop, RNAPointerSource source)
    : id(id), ptr(ptr), prop(prop), source(source)
{
}

string RNAPathKey::identifier() const
{
  const char *id_name = (id) ? id->name : "<No ID>";
  const char *prop_name = (prop) ? RNA_property_identifier(prop) : "<No Prop>";
  return string("RnaPathKey(") + "id: " + id_name + ", prop: '" + prop_name + "')";
}

}  // namespace deg
}  // namespace blender