예제 #1
0
void ILightingEngineFactory::add_common_params_metadata(
    Dictionary& metadata,
    const bool  add_lighting_samples)
{
    metadata.dictionaries().insert(
        "enable_ibl",
        Dictionary()
            .insert("type", "bool")
            .insert("default", "on")
            .insert("label", "Enable IBL")
            .insert("help", "Enable image-based lighting"));

    if (add_lighting_samples)
    {
        metadata.dictionaries().insert(
            "dl_light_samples",
            Dictionary()
                .insert("type", "float")
                .insert("default", "1.0")
                .insert("label", "Light Samples")
                .insert("help", "Number of samples used to estimate direct lighting"));

        metadata.dictionaries().insert(
            "ibl_env_samples",
            Dictionary()
                .insert("type", "float")
                .insert("default", "1.0")
                .insert("label", "IBL Samples")
                .insert("help", "Number of samples used to estimate environment lighting"));
    }
}
예제 #2
0
DictionaryArray GradientEnvironmentEDFFactory::get_widget_definitions() const
{
    DictionaryArray definitions;

    definitions.push_back(
        Dictionary()
            .insert("name", "horizon_exitance")
            .insert("label", "Horizon Exitance")
            .insert("widget", "entity_picker")
            .insert("entity_types",
                Dictionary()
                    .insert("color", "Colors"))
            .insert("use", "required")
            .insert("default", ""));

    definitions.push_back(
        Dictionary()
            .insert("name", "zenith_exitance")
            .insert("label", "Zenith Exitance")
            .insert("widget", "entity_picker")
            .insert("entity_types",
                Dictionary()
                    .insert("color", "Colors"))
            .insert("use", "required")
            .insert("default", ""));

    return definitions;
}
예제 #3
0
DictionaryArray FisheyeLensCameraFactory::get_input_metadata() const
{
    DictionaryArray metadata = CameraFactory::get_input_metadata();

    CameraFactory::add_film_metadata(metadata);
    CameraFactory::add_lens_metadata(metadata);
    CameraFactory::add_clipping_metadata(metadata);
    CameraFactory::add_shift_metadata(metadata);

    metadata.push_back(
    Dictionary()
        .insert("name", "projection_type")
        .insert("label", "Projection Type")
        .insert("type", "enumeration")
        .insert("items",
            Dictionary()
                .insert("Equisolid Angle", "equisolid_angle")
                .insert("Equidistant", "equidistant")
                .insert("Stereographic", "stereographic")
                .insert("Thoby", "thoby"))
        .insert("default", "equisolid_angle")
        .insert("use", "required"));

    return metadata;
}
예제 #4
0
TEST_F(AnimationAnimationV8Test, SpecifiedDurationGetter)
{
    Vector<Dictionary, 0> jsKeyframes;

    v8::Handle<v8::Object> timingInputWithDuration = v8::Object::New(m_isolate);
    setV8ObjectPropertyAsNumber(timingInputWithDuration, "duration", 2.5);
    Dictionary timingInputDictionaryWithDuration = Dictionary(v8::Handle<v8::Value>::Cast(timingInputWithDuration), m_isolate);

    RefPtrWillBeRawPtr<Animation> animationWithDuration = createAnimation(element.get(), jsKeyframes, timingInputDictionaryWithDuration, exceptionState);

    RefPtrWillBeRawPtr<AnimationNodeTiming> specifiedWithDuration = animationWithDuration->timing();
    Nullable<double> numberDuration;
    String stringDuration;
    specifiedWithDuration->getDuration("duration", numberDuration, stringDuration);
    EXPECT_FALSE(numberDuration.isNull());
    EXPECT_EQ(2.5, numberDuration.get());
    EXPECT_TRUE(stringDuration.isNull());


    v8::Handle<v8::Object> timingInputNoDuration = v8::Object::New(m_isolate);
    Dictionary timingInputDictionaryNoDuration = Dictionary(v8::Handle<v8::Value>::Cast(timingInputNoDuration), m_isolate);

    RefPtrWillBeRawPtr<Animation> animationNoDuration = createAnimation(element.get(), jsKeyframes, timingInputDictionaryNoDuration, exceptionState);

    RefPtrWillBeRawPtr<AnimationNodeTiming> specifiedNoDuration = animationNoDuration->timing();
    Nullable<double> numberDuration2;
    String stringDuration2;
    specifiedNoDuration->getDuration("duration", numberDuration2, stringDuration2);
    EXPECT_TRUE(numberDuration2.isNull());
    EXPECT_FALSE(stringDuration2.isNull());
    EXPECT_EQ("auto", stringDuration2);
}
예제 #5
0
TEST(AnimationEffectInputTest, LooslySorted) {
  V8TestingScope scope;
  Vector<Dictionary> jsKeyframes;
  v8::Local<v8::Object> keyframe1 = v8::Object::New(scope.isolate());
  v8::Local<v8::Object> keyframe2 = v8::Object::New(scope.isolate());
  v8::Local<v8::Object> keyframe3 = v8::Object::New(scope.isolate());

  setV8ObjectPropertyAsString(scope.isolate(), keyframe1, "width", "100px");
  setV8ObjectPropertyAsString(scope.isolate(), keyframe1, "offset", "0");
  setV8ObjectPropertyAsString(scope.isolate(), keyframe2, "width", "200px");
  setV8ObjectPropertyAsString(scope.isolate(), keyframe3, "width", "0px");
  setV8ObjectPropertyAsString(scope.isolate(), keyframe3, "offset", "1");

  jsKeyframes.push_back(
      Dictionary(scope.isolate(), keyframe1, scope.getExceptionState()));
  jsKeyframes.push_back(
      Dictionary(scope.isolate(), keyframe2, scope.getExceptionState()));
  jsKeyframes.push_back(
      Dictionary(scope.isolate(), keyframe3, scope.getExceptionState()));

  Element* element = appendElement(scope.document());
  EffectModel* animationEffect = EffectInput::convert(
      element,
      DictionarySequenceOrDictionary::fromDictionarySequence(jsKeyframes),
      nullptr, scope.getExceptionState());
  EXPECT_FALSE(scope.getExceptionState().hadException());
  const KeyframeEffectModelBase& keyframeEffect =
      *toKeyframeEffectModelBase(animationEffect);
  EXPECT_EQ(1, keyframeEffect.getFrames()[2]->offset());
}
예제 #6
0
DictionaryArray LambertianBRDFFactory::get_widget_definitions() const
{
    DictionaryArray definitions;

    definitions.push_back(
        Dictionary()
            .insert("name", "reflectance")
            .insert("label", "Reflectance")
            .insert("widget", "entity_picker")
            .insert("entity_types",
                Dictionary()
                    .insert("color", "Colors")
                    .insert("texture_instance", "Textures"))
            .insert("use", "required")
            .insert("default", ""));

    definitions.push_back(
        Dictionary()
            .insert("name", "reflectance_multiplier")
            .insert("label", "Reflectance Multiplier")
            .insert("widget", "entity_picker")
            .insert("entity_types",
                Dictionary().insert("texture_instance", "Textures"))
            .insert("use", "optional")
            .insert("default", "1.0"));

    return definitions;
}
예제 #7
0
TEST(AnimationEffectInputTest, OutOfOrderWithNullOffsets) {
  V8TestingScope scope;
  Vector<Dictionary> jsKeyframes;
  v8::Local<v8::Object> keyframe1 = v8::Object::New(scope.isolate());
  v8::Local<v8::Object> keyframe2 = v8::Object::New(scope.isolate());
  v8::Local<v8::Object> keyframe3 = v8::Object::New(scope.isolate());
  v8::Local<v8::Object> keyframe4 = v8::Object::New(scope.isolate());

  setV8ObjectPropertyAsString(scope.isolate(), keyframe1, "height", "100px");
  setV8ObjectPropertyAsString(scope.isolate(), keyframe1, "offset", "0.5");
  setV8ObjectPropertyAsString(scope.isolate(), keyframe2, "height", "150px");
  setV8ObjectPropertyAsString(scope.isolate(), keyframe3, "height", "200px");
  setV8ObjectPropertyAsString(scope.isolate(), keyframe3, "offset", "0");
  setV8ObjectPropertyAsString(scope.isolate(), keyframe4, "height", "300px");
  setV8ObjectPropertyAsString(scope.isolate(), keyframe4, "offset", "1");

  jsKeyframes.push_back(
      Dictionary(scope.isolate(), keyframe1, scope.getExceptionState()));
  jsKeyframes.push_back(
      Dictionary(scope.isolate(), keyframe2, scope.getExceptionState()));
  jsKeyframes.push_back(
      Dictionary(scope.isolate(), keyframe3, scope.getExceptionState()));
  jsKeyframes.push_back(
      Dictionary(scope.isolate(), keyframe4, scope.getExceptionState()));

  Element* element = appendElement(scope.document());
  EffectInput::convert(
      element,
      DictionarySequenceOrDictionary::fromDictionarySequence(jsKeyframes),
      nullptr, scope.getExceptionState());
  EXPECT_TRUE(scope.getExceptionState().hadException());
}
예제 #8
0
TEST(AnimationEffectInputTest, Invalid) {
  V8TestingScope scope;
  // Not loosely sorted by offset, and there exists a keyframe with null offset.
  Vector<Dictionary> jsKeyframes;
  v8::Local<v8::Object> keyframe1 = v8::Object::New(scope.isolate());
  v8::Local<v8::Object> keyframe2 = v8::Object::New(scope.isolate());
  v8::Local<v8::Object> keyframe3 = v8::Object::New(scope.isolate());

  setV8ObjectPropertyAsString(scope.isolate(), keyframe1, "width", "0px");
  setV8ObjectPropertyAsString(scope.isolate(), keyframe1, "offset", "1");
  setV8ObjectPropertyAsString(scope.isolate(), keyframe2, "width", "200px");
  setV8ObjectPropertyAsString(scope.isolate(), keyframe3, "width", "100px");
  setV8ObjectPropertyAsString(scope.isolate(), keyframe3, "offset", "0");

  jsKeyframes.push_back(
      Dictionary(scope.isolate(), keyframe1, scope.getExceptionState()));
  jsKeyframes.push_back(
      Dictionary(scope.isolate(), keyframe2, scope.getExceptionState()));
  jsKeyframes.push_back(
      Dictionary(scope.isolate(), keyframe3, scope.getExceptionState()));

  Element* element = appendElement(scope.document());
  EffectInput::convert(
      element,
      DictionarySequenceOrDictionary::fromDictionarySequence(jsKeyframes),
      nullptr, scope.getExceptionState());
  EXPECT_TRUE(scope.getExceptionState().hadException());
  EXPECT_EQ(V8TypeError, scope.getExceptionState().code());
}
PassRefPtr<EntrySync> WorkerGlobalScopeFileSystem::webkitResolveLocalFileSystemSyncURL(WorkerGlobalScope* worker, const String& url, ExceptionCode& ec)
{
    ec = 0;
    KURL completedURL = worker->completeURL(url);
    ScriptExecutionContext* secureContext = worker->scriptExecutionContext();
    if (!AsyncFileSystem::isAvailable() || !secureContext->securityOrigin()->canAccessFileSystem() || !secureContext->securityOrigin()->canRequest(completedURL)) {
        ec = FileException::SECURITY_ERR;
        return 0;
    }

    FileSystemType type;
    String filePath;
    if (!completedURL.isValid() || !DOMFileSystemBase::crackFileSystemURL(completedURL, type, filePath)) {
        ec = FileException::ENCODING_ERR;
        return 0;
    }

    FileSystemSyncCallbackHelper readFileSystemHelper;
    LocalFileSystem::localFileSystem().readFileSystem(worker, type, FileSystemCallbacks::create(readFileSystemHelper.successCallback(), readFileSystemHelper.errorCallback(), worker, type), SynchronousFileSystem);
    RefPtr<DOMFileSystemSync> fileSystem = readFileSystemHelper.getResult(ec);
    if (!fileSystem)
        return 0;

    RefPtr<EntrySync> entry = fileSystem->root()->getDirectory(filePath, Dictionary(), ec);
    if (ec == FileException::TYPE_MISMATCH_ERR)
        return fileSystem->root()->getFile(filePath, Dictionary(), ec);

    return entry.release();
}
예제 #10
0
DictionaryArray ObjectInstanceFactory::get_input_metadata()
{
    DictionaryArray metadata;

    metadata.push_back(
        Dictionary()
            .insert("name", "ray_bias_method")
            .insert("label", "Ray Bias Method")
            .insert("type", "enumeration")
            .insert("items",
                Dictionary()
                    .insert("No Ray Bias", "none")
                    .insert("Shift Along Surface Normal", "normal")
                    .insert("Shift Along Incoming Direction", "incoming_direction")
                    .insert("Shift Along Outgoing Direction", "outgoing_direction"))
            .insert("use", "optional")
            .insert("default", "none"));

    metadata.push_back(
        Dictionary()
            .insert("name", "ray_bias_distance")
            .insert("label", "Ray Bias Distance")
            .insert("type", "text")
            .insert("use", "optional")
            .insert("default", "0.0"));

    return metadata;
}
예제 #11
0
DictionaryArray SheenBRDFFactory::get_input_metadata() const
{
    DictionaryArray metadata;

    metadata.push_back(
        Dictionary()
            .insert("name", "reflectance")
            .insert("label", "Reflectance")
            .insert("type", "colormap")
            .insert("entity_types",
                Dictionary()
                    .insert("color", "Colors")
                    .insert("texture_instance", "Texture Instances"))
            .insert("use", "required")
            .insert("default", "0.5"));

    metadata.push_back(
        Dictionary()
            .insert("name", "reflectance_multiplier")
            .insert("label", "Reflectance Multiplier")
            .insert("type", "colormap")
            .insert("entity_types",
                Dictionary().insert("texture_instance", "Texture Instances"))
            .insert("use", "optional")
            .insert("default", "1.0"));

    return metadata;
}
DictionaryArray ConstantHemisphereEnvironmentEDFFactory::get_input_metadata() const
{
    DictionaryArray metadata;

    metadata.push_back(
        Dictionary()
            .insert("name", "upper_hemi_radiance")
            .insert("label", "Upper Hemisphere Radiance")
            .insert("type", "colormap")
            .insert("entity_types",
                Dictionary().insert("color", "Colors"))
            .insert("use", "required")
            .insert("default", "0.7")
            .insert("help", "Upper hemisphere radiance"));

    metadata.push_back(
        Dictionary()
            .insert("name", "lower_hemi_radiance")
            .insert("label", "Lower Hemisphere Radiance")
            .insert("type", "colormap")
            .insert("entity_types",
                Dictionary().insert("color", "Colors"))
            .insert("use", "required")
            .insert("default", "0.3")
            .insert("help", "Lower hemisphere radiance"));

    return metadata;
}
예제 #13
0
godot_dictionary GDAPI godot_variant_as_dictionary(const godot_variant *p_self) {
	godot_dictionary raw_dest;
	const Variant *self = (const Variant *)p_self;
	Dictionary *dest = (Dictionary *)&raw_dest;
	memnew_placement(dest, Dictionary(self->operator Dictionary())); // operator = is overloaded by Dictionary
	return raw_dest;
}
예제 #14
0
void ConnectionsDialog::_connect() {
	
	TreeItem *it = tree->get_selected();
	ERR_FAIL_COND(!it);
	String signal=it->get_metadata(0).operator Dictionary()["name"];

	NodePath dst_path=connect_dialog->get_dst_path();
	Node *target = node->get_node(dst_path);
	ERR_FAIL_COND(!target);

	StringName dst_method=connect_dialog->get_dst_method();
	bool defer=connect_dialog->get_deferred();
	Vector<Variant> binds = connect_dialog->get_binds();
	StringArray args =  it->get_metadata(0).operator Dictionary()["args"];

	undo_redo->create_action("Connect '"+signal+"' to '"+String(dst_method)+"'");
	undo_redo->add_do_method(node,"connect",signal,target,dst_method,binds,CONNECT_PERSIST | (defer?CONNECT_DEFERRED:0));
	undo_redo->add_undo_method(node,"disconnect",signal,target,dst_method);
	undo_redo->add_do_method(this,"update_tree");
	undo_redo->add_undo_method(this,"update_tree");
	undo_redo->commit_action();


	if (connect_dialog->get_make_callback()) {

		print_line("request connect");
		editor->emit_signal("script_add_function_request",target,dst_method,args);
		hide();
	}

	update_tree();

}
DictionaryArray ConstantHemisphereEnvironmentEDFFactory::get_widget_definitions() const
{
    DictionaryArray definitions;

    definitions.push_back(
        Dictionary()
        .insert("name", "upper_hemi_exitance")
        .insert("label", "Upper Hemisphere Exitance")
        .insert("widget", "entity_picker")
        .insert("entity_types",
                Dictionary().insert("color", "Colors"))
        .insert("use", "required")
        .insert("default", ""));

    definitions.push_back(
        Dictionary()
        .insert("name", "lower_hemi_exitance")
        .insert("label", "Lower Hemisphere Exitance")
        .insert("widget", "entity_picker")
        .insert("entity_types",
                Dictionary().insert("color", "Colors"))
        .insert("use", "required")
        .insert("default", ""));

    return definitions;
}
예제 #16
0
void IEDFFactory::add_common_input_metadata(DictionaryArray& metadata)
{
    metadata.push_back(
        Dictionary()
            .insert("name", "cast_indirect_light")
            .insert("label", "Cast Indirect Light")
            .insert("type", "boolean")
            .insert("use", "optional")
            .insert("default", "true"));

    metadata.push_back(
        Dictionary()
            .insert("name", "importance_multiplier")
            .insert("label", "Importance Multiplier")
            .insert("type", "numeric")
            .insert("min_value", "0.0")
            .insert("max_value", "10.0")
            .insert("use", "optional")
            .insert("default", "1.0"));

    metadata.push_back(
        Dictionary()
            .insert("name", "light_near_start")
            .insert("label", "Light Near Start")
            .insert("type", "numeric")
            .insert("min_value", "0.0")
            .insert("max_value", "10.0")
            .insert("use", "optional")
            .insert("default", "0.0"));
}
예제 #17
0
namespace casadi {

/**
\ingroup expression_tools
@{
*/
  /** \brief  Solve a system of equations: A*x = b
      The solve routine works similar to Matlab's backslash when A is square and nonsingular.
      The algorithm used is the following:
      1. A simple forward or backward substitution if A is upper or lower triangular
      2. If the linear system is at most 3-by-3, form the inverse via minor expansion and multiply
      3. Permute the variables and equations as to get a (structurally) nonzero diagonal,
      then perform a QR factorization without pivoting and solve the factorized system.

      Note 1: If there are entries of the linear system known to be zero, these will be removed.
      Elements that are very small, or will evaluate to be zero, can still cause numerical errors,
      due to the lack of pivoting (which is not possible since cannot compare the size of entries)

      Note 2: When permuting the linear system, a BLT (block lower triangular) transformation is
      formed. Only the permutation part of this is however used. An improvement would be to solve
      block-by-block if there are multiple BLT blocks.

  */
  template<typename DataType>
  Matrix<DataType> solve(const Matrix<DataType>& A, const Matrix<DataType>& b) {
    return A.zz_solve(b);
  }

  /** \brief Computes the Moore-Penrose pseudo-inverse
  *
  * If the matrix A is fat (size2>size1), mul(A, pinv(A)) is unity.
  * If the matrix A is slender (size1<size2), mul(pinv(A), A) is unity.
  *
  */
  template<typename DataType>
  Matrix<DataType> pinv(const Matrix<DataType>& A) { return A.zz_pinv();}

  /** \brief Solve a system of equations: A*x = b
  */
  CASADI_EXPORT Matrix<double> solve(const Matrix<double>& A, const Matrix<double>& b,
                                          const std::string& lsolver,
                                          const Dictionary& dict = Dictionary());


  /** \brief Computes the Moore-Penrose pseudo-inverse
  *
  * If the matrix A is fat (size1>size2), mul(A, pinv(A)) is unity.
  * If the matrix A is slender (size2<size1), mul(pinv(A), A) is unity.
  *
  */
  CASADI_EXPORT Matrix<double> pinv(const Matrix<double>& A, const std::string& lsolver,
                                    const Dictionary& dict = Dictionary());
/*
@}
*/

} // namespace casadi
예제 #18
0
TEST_F(AnimationAnimationTest, CanCreateAnAnimation)
{
    v8::Isolate* isolate = v8::Isolate::GetCurrent();
    v8::HandleScope scope(isolate);
    v8::Local<v8::Context> context = v8::Context::New(isolate);
    v8::Context::Scope contextScope(context);

    Vector<Dictionary> jsKeyframes;
    v8::Handle<v8::Object> keyframe1 = v8::Object::New(isolate);
    v8::Handle<v8::Object> keyframe2 = v8::Object::New(isolate);

    setV8ObjectPropertyAsString(keyframe1, "width", "100px");
    setV8ObjectPropertyAsString(keyframe1, "offset", "0");
    setV8ObjectPropertyAsString(keyframe1, "easing", "ease-in-out");
    setV8ObjectPropertyAsString(keyframe2, "width", "0px");
    setV8ObjectPropertyAsString(keyframe2, "offset", "1");
    setV8ObjectPropertyAsString(keyframe2, "easing", "cubic-bezier(1, 1, 0.3, 0.3)");

    jsKeyframes.append(Dictionary(keyframe1, isolate));
    jsKeyframes.append(Dictionary(keyframe2, isolate));

    String value1;
    ASSERT_TRUE(jsKeyframes[0].get("width", value1));
    ASSERT_EQ("100px", value1);

    String value2;
    ASSERT_TRUE(jsKeyframes[1].get("width", value2));
    ASSERT_EQ("0px", value2);

    RefPtr<Animation> animation = createAnimation(element.get(), jsKeyframes, 0);

    Element* target = animation->target();
    EXPECT_EQ(*element.get(), *target);

    const KeyframeEffectModel::KeyframeVector keyframes =
        toKeyframeEffectModel(animation->effect())->getFrames();

    EXPECT_EQ(0, keyframes[0]->offset());
    EXPECT_EQ(1, keyframes[1]->offset());

    const AnimatableValue* keyframe1Width = keyframes[0]->propertyValue(CSSPropertyWidth);
    const AnimatableValue* keyframe2Width = keyframes[1]->propertyValue(CSSPropertyWidth);
    ASSERT(keyframe1Width);
    ASSERT(keyframe2Width);

    EXPECT_TRUE(keyframe1Width->isLength());
    EXPECT_TRUE(keyframe2Width->isLength());

    EXPECT_EQ("100px", toAnimatableLength(keyframe1Width)->toCSSValue()->cssText());
    EXPECT_EQ("0px", toAnimatableLength(keyframe2Width)->toCSSValue()->cssText());

    EXPECT_EQ(*(CubicBezierTimingFunction::preset(CubicBezierTimingFunction::EaseInOut)), *keyframes[0]->easing());
    EXPECT_EQ(*(CubicBezierTimingFunction::create(1, 1, 0.3, 0.3).get()), *keyframes[1]->easing());
}
예제 #19
0
TEST_F(AnimationElementAnimationTest, CanStartAnAnimation)
{
    v8::Isolate* isolate = v8::Isolate::GetCurrent();
    v8::HandleScope scope(isolate);
    v8::Local<v8::Context> context = v8::Context::New(isolate);
    v8::Context::Scope contextScope(context);

    Vector<Dictionary> jsKeyframes;
    v8::Handle<v8::Object> keyframe1 = v8::Object::New();
    v8::Handle<v8::Object> keyframe2 = v8::Object::New();

    setV8ObjectProperty(keyframe1, "width", "100px");
    setV8ObjectProperty(keyframe1, "offset", "0");
    setV8ObjectProperty(keyframe2, "width", "0px");
    setV8ObjectProperty(keyframe2, "offset", "1");

    jsKeyframes.append(Dictionary(keyframe1, isolate));
    jsKeyframes.append(Dictionary(keyframe2, isolate));

    String value1;
    ASSERT_TRUE(jsKeyframes[0].get("width", value1));
    ASSERT_EQ("100px", value1);

    String value2;
    ASSERT_TRUE(jsKeyframes[1].get("width", value2));
    ASSERT_EQ("0px", value2);

    startAnimation(element.get(), jsKeyframes);

    Player* player = document->timeline()->players().at(0).get();

    Animation* animation = toAnimation(player->source());

    Element* target = animation->target();
    EXPECT_EQ(*element.get(), *target);

    const KeyframeAnimationEffect::KeyframeVector keyframes =
        toKeyframeAnimationEffect(animation->effect())->getFrames();

    EXPECT_EQ(0, keyframes[0]->offset());
    EXPECT_EQ(1, keyframes[1]->offset());

    const AnimatableValue* keyframe1Width = keyframes[0]->propertyValue(CSSPropertyWidth);
    const AnimatableValue* keyframe2Width = keyframes[1]->propertyValue(CSSPropertyWidth);
    ASSERT(keyframe1Width);
    ASSERT(keyframe2Width);

    EXPECT_TRUE(keyframe1Width->isLength());
    EXPECT_TRUE(keyframe2Width->isLength());

    EXPECT_EQ("100px", toAnimatableLength(keyframe1Width)->toCSSValue()->cssText());
    EXPECT_EQ("0px", toAnimatableLength(keyframe2Width)->toCSSValue()->cssText());
}
예제 #20
0
Dictionary mono_object_to_Dictionary(MonoObject *p_dict) {
	Dictionary ret;

	GDMonoUtils::MarshalUtils_DictToArrays dict_to_arrays = CACHED_METHOD_THUNK(MarshalUtils, DictionaryToArrays);

	MonoArray *keys = NULL;
	MonoArray *values = NULL;
	MonoObject *ex = NULL;
	dict_to_arrays(p_dict, &keys, &values, &ex);

	if (ex) {
		mono_print_unhandled_exception(ex);
		ERR_FAIL_V(Dictionary());
	}

	int length = mono_array_length(keys);

	for (int i = 0; i < length; i++) {
		MonoObject *key_obj = mono_array_get(keys, MonoObject *, i);
		MonoObject *value_obj = mono_array_get(values, MonoObject *, i);

		Variant key = key_obj ? mono_object_to_variant(key_obj) : Variant();
		Variant value = value_obj ? mono_object_to_variant(value_obj) : Variant();

		ret[key] = value;
	}

	return ret;
}
예제 #21
0
 Timing applyTimingInputString(String timingProperty, String timingPropertyValue)
 {
     v8::Handle<v8::Object> timingInput = v8::Object::New(m_isolate);
     setV8ObjectPropertyAsString(timingInput, timingProperty, timingPropertyValue);
     Dictionary timingInputDictionary = Dictionary(v8::Handle<v8::Value>::Cast(timingInput), m_isolate);
     return TimingInput::convert(timingInputDictionary);
 }
예제 #22
0
Dictionary SphereObjectFactory::get_model_metadata() const
{
    return
        Dictionary()
            .insert("name", Model)
            .insert("label", "Sphere Object");
}
예제 #23
0
파일: gd_mono_utils.cpp 프로젝트: 93i/godot
MonoObject *create_managed_from(const Dictionary &p_from, GDMonoClass *p_class) {
	MonoObject *mono_object = mono_object_new(SCRIPTS_DOMAIN, p_class->get_mono_ptr());
	ERR_FAIL_NULL_V(mono_object, NULL);

	// Search constructor that takes a pointer as parameter
	MonoMethod *m;
	void *iter = NULL;
	while ((m = mono_class_get_methods(p_class->get_mono_ptr(), &iter))) {
		if (strcmp(mono_method_get_name(m), ".ctor") == 0) {
			MonoMethodSignature *sig = mono_method_signature(m);
			void *front = NULL;
			if (mono_signature_get_param_count(sig) == 1 &&
					mono_class_from_mono_type(mono_signature_get_params(sig, &front)) == CACHED_CLASS(IntPtr)->get_mono_ptr()) {
				break;
			}
		}
	}

	CRASH_COND(m == NULL);

	Dictionary *new_dict = memnew(Dictionary(p_from));
	void *args[1] = { &new_dict };

	MonoException *exc = NULL;
	GDMonoUtils::runtime_invoke(m, mono_object, args, &exc);
	UNLIKELY_UNHANDLED_EXCEPTION(exc);

	return mono_object;
}
EncodedJSValue JSC_HOST_CALL constructJSRTCSessionDescription(ExecState* exec)
{
    ExceptionCode ec = 0;
    Dictionary sessionInit;
    if (exec->argumentCount() > 0) {
        sessionInit = Dictionary(exec, exec->argument(0));
        if (!sessionInit.isObject())
            return throwVMError(exec, createTypeError(exec, "Optional RTCSessionDescription constructor argument must be a valid Dictionary"));

        if (exec->hadException())
            return JSValue::encode(jsUndefined());
    }

    DOMConstructorObject* jsConstructor = jsCast<DOMConstructorObject*>(exec->callee());
    RefPtr<RTCSessionDescription> sessionDescription = RTCSessionDescription::create(sessionInit, ec);
    if (ec == TYPE_MISMATCH_ERR) {
        setDOMException(exec, ec);
        return throwVMError(exec, createTypeError(exec, "Invalid RTCSessionDescription constructor arguments"));
    }

    if (ec) {
        setDOMException(exec, ec);
        return throwVMError(exec, createTypeError(exec, "Error creating RTCSessionDescription"));
    }

    return JSValue::encode(CREATE_DOM_WRAPPER(jsConstructor->globalObject(), RTCSessionDescription, sessionDescription.get()));
}
예제 #25
0
ParamArray& ParamArray::insert_path(const char* path, const char* value)
{
    assert(path);
    assert(value);

    vector<string> parts;
    tokenize(path, PartSeparator, parts);

    assert(!parts.empty());

    Dictionary* leaf = this;

    for (size_t i = 0; i < parts.size() - 1; ++i)
    {
        const string& part = parts[i];

        if (!leaf->dictionaries().exist(part))
            leaf->insert(part, Dictionary());

        leaf = &leaf->dictionary(part);
    }

    leaf->insert(parts.back(), value);

    return *this;
}
예제 #26
0
TEST_F(AnimationAnimationV8Test, SetSpecifiedDuration)
{
    Vector<Dictionary, 0> jsKeyframes;
    v8::Handle<v8::Object> timingInput = v8::Object::New(m_isolate);
    Dictionary timingInputDictionary = Dictionary(v8::Handle<v8::Value>::Cast(timingInput), m_isolate);
    RefPtrWillBeRawPtr<Animation> animation = createAnimation(element.get(), jsKeyframes, timingInputDictionary, exceptionState);

    RefPtrWillBeRawPtr<AnimationNodeTiming> specified = animation->timing();

    bool isNumber = false;
    double numberDuration = std::numeric_limits<double>::quiet_NaN();
    bool isString = false;
    String stringDuration = "";
    specified->getDuration("duration", isNumber, numberDuration, isString, stringDuration);
    EXPECT_FALSE(isNumber);
    EXPECT_TRUE(std::isnan(numberDuration));
    EXPECT_TRUE(isString);
    EXPECT_EQ("auto", stringDuration);

    specified->setDuration("duration", 2.5);
    isNumber = false;
    numberDuration = std::numeric_limits<double>::quiet_NaN();
    isString = false;
    stringDuration = "";
    specified->getDuration("duration", isNumber, numberDuration, isString, stringDuration);
    EXPECT_TRUE(isNumber);
    EXPECT_EQ(2.5, numberDuration);
    EXPECT_FALSE(isString);
    EXPECT_EQ("", stringDuration);
}
예제 #27
0
TEST_F(AnimationAnimationV8Test, SpecifiedGetters)
{
    Vector<Dictionary, 0> jsKeyframes;

    v8::Handle<v8::Object> timingInput = v8::Object::New(m_isolate);
    setV8ObjectPropertyAsNumber(timingInput, "delay", 2);
    setV8ObjectPropertyAsNumber(timingInput, "endDelay", 0.5);
    setV8ObjectPropertyAsString(timingInput, "fill", "backwards");
    setV8ObjectPropertyAsNumber(timingInput, "iterationStart", 2);
    setV8ObjectPropertyAsNumber(timingInput, "iterations", 10);
    setV8ObjectPropertyAsNumber(timingInput, "playbackRate", 2);
    setV8ObjectPropertyAsString(timingInput, "direction", "reverse");
    setV8ObjectPropertyAsString(timingInput, "easing", "step-start");
    Dictionary timingInputDictionary = Dictionary(v8::Handle<v8::Value>::Cast(timingInput), m_isolate);

    RefPtrWillBeRawPtr<Animation> animation = createAnimation(element.get(), jsKeyframes, timingInputDictionary, exceptionState);

    RefPtrWillBeRawPtr<AnimationNodeTiming> specified = animation->timing();
    EXPECT_EQ(2, specified->delay());
    EXPECT_EQ(0.5, specified->endDelay());
    EXPECT_EQ("backwards", specified->fill());
    EXPECT_EQ(2, specified->iterationStart());
    EXPECT_EQ(10, specified->iterations());
    EXPECT_EQ(2, specified->playbackRate());
    EXPECT_EQ("reverse", specified->direction());
    EXPECT_EQ("step-start", specified->easing());
}
예제 #28
0
Dictionary AlbedoAOVFactory::get_model_metadata() const
{
    return
        Dictionary()
            .insert("name", get_model())
            .insert("label", "Albedo");
}
static v8::Handle<v8::Value> webkitGetUserMediaCallback(const v8::Arguments& args)
{
    if (args.Length() < 2)
        return throwNotEnoughArgumentsError(args.GetIsolate());
    Navigator* imp = V8Navigator::toNative(args.Holder());
    ExceptionCode ec = 0;
    {
    V8TRYCATCH(Dictionary, options, Dictionary(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined), args.GetIsolate()));
    if (!options.isUndefinedOrNull() && !options.isObject())
        return throwTypeError("Not an object.", args.GetIsolate());
    if (args.Length() <= 1 || !args[1]->IsFunction())
        return throwTypeError(0, args.GetIsolate());
    RefPtr<NavigatorUserMediaSuccessCallback> successCallback = V8NavigatorUserMediaSuccessCallback::create(args[1], getScriptExecutionContext());
    RefPtr<NavigatorUserMediaErrorCallback> errorCallback;
    if (args.Length() > 2 && !args[2]->IsNull() && !args[2]->IsUndefined()) {
        if (!args[2]->IsFunction())
            return throwTypeError(0, args.GetIsolate());
        errorCallback = V8NavigatorUserMediaErrorCallback::create(args[2], getScriptExecutionContext());
    }
    NavigatorMediaStream::webkitGetUserMedia(imp, options, successCallback, errorCallback, ec);
    if (UNLIKELY(ec))
        goto fail;
    return v8Undefined();
    }
    fail:
    return setDOMException(ec, args.GetIsolate());
}
예제 #30
0
Dictionary AssemblyFactory::get_model_metadata() const
{
    return
        Dictionary()
            .insert("name", Model)
            .insert("label", "Generic Assembly");
}